Question: You cannot use any predefined functions for the calculation. The program must also use the 'while' function. Calculate the factorial of an integer. The definition

You cannot use any predefined functions for the calculation. The program must also use the 'while' function.
Calculate the factorial of an integer. The definition of a factorial is: 2)...(3)(2)(1).
The algorithm must take into consideration the special case that the factorial of zero is 1 by definition.
In addition to the above, the program must also verify that the number is not negative, which turns out to be
Invalid.
Run the program to calculate the factorial of the following values: 3,-4,1,0 and 8.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!