Question: In math, n nn-1n-2...2.1. For example, 6! 6*5*4*3*2*1. Note 1! 1 and 0! 1. Write a program to calculate the factorial. 1. Prompt the user
In math, n nn-1n-2...2.1. For example, 6! 6*5*4*3*2*1. Note 1! 1 and 0! 1. Write a program to calculate the factorial. 1. Prompt the user to enter a number from 0 to MAX inclusive. Do a few trials to decide what the MAX is reasonable for your computer. Check the validity of the user input. 2. Implement the factorial function in three ways: while, for, do while. Use Figure 5.7 as a reference. 3. Compare briefly among while, for, do while using comments in the end of your program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
