Question: Using a while loop, write a program that calculates the factorial of a number. 5 ! 5 x 4 x 3 x 2 x 1...120.

Using a while loop, write a program that calculates the factorial of a number. 5 ! 5 x 4 x 3 x 2 x 1...120. Use one variable to hold the number of which you want to find the factorial. You can use a while loop to loop through the multiplications until youve reached that number. Use another variable to hold the result during the loop. Finally, use an echo statement to display the result. 1x browser print and code.

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!