| nik96 (4) | |
|
i need help to calculate the factorial with function The program should then calculate the factorial of the number n, where n!= n×(n −1)...× 2×1 the output like this: Enter number: 4 Factorial of 4! = 24 Enter number: 6 Factorial of 6! = 720 Enter number: 3 Factorial of 3! = 6 Enter number: 0 Factorial of 0! = 1 Enter number: -5 Factorial of -5! = -1 Press any key to continue . .... | |
|
|
|
| tvrameshmc (54) | |||
This is recursive function to calculate factorial of a number. | |||
|
|
|||
| nik96 (4) | |
| thank you so much for the answer..!! | |
|
|
|
| nik96 (4) | |||
and call two function the first asked the user to type a number use one for loop and second used
| |||
|
Last edited on
|
|||
| tvrameshmc (54) | |||
| |||
|
|
|||
| vlad from moscow (3655) | ||||
The code does not correspond to the original assignment because for negative numbers the function shall return -1. | ||||
|
Last edited on
|
||||
| nik96 (4) | |
| What is the full code? | |
|
|
|
| vlad from moscow (3655) | ||
It is your task to write the full code. One of possible realization was already demonstrated. | ||
|
|
||