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

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

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 Databases Questions!