a c language program that compute the factorial of any number using do while loop

Output:
Enter any number to find factorial: 5
The factorial of 5 is 120


Explanation
Variable n is declared to find the factorial of any number and variable fact is declared to hold the calculated factorial of any number.
Our program begins with by displaying the message to user "enter any number" whose factorial they want to calculate.
Then the input number is get stored into the variable n.
Program show message that factorial is not defined for negative numbers when if the given input number is negative.
The program initializes the given variable i to the value 1 and jumps inside do while loop if the input number is non negative.
factorial i.e. fact is calculated inside the loop by multiplying fact with the value of i and value of i is incremented by 1 in each iteration.
Until the value of i does not reach to the n the loop continues the execution.
The program prints the calculated factorial of the entered number once the loop completes execution.
Using do while loop in C this program demonstrated effectively how to compute factorial.
This program show that the factorial for positive integers is correctly calculated.


Previous :-->> 1. Write a program in c language to find the sum of all numbers between two given numbers using a while loop.
 -->> NEXT: 3.Write a program in c programming to print the reverse of any given number using a for loop.
-->>ALL Loops Assignments in c