Program to Calculate the Factorial Using Do While

Write a Program to calculate the factorial of entered no. using do while. Calculate the Factorial Using Do While
Algorithm:
- Start
- Enter a Number – A
- do
{
fact=fact*i;
i++;
}
while(i<=n); - Print Factorial=fact(a)
- Stop
Source Code
#include<conio.h> #include<iostream.h> void main() { clrscr(); int n,fact=1,i=1; cout<<"Enter the number:"<<endl; cin>>n; do { fact=fact*i; i++; } while(i<=n); cout<<"The factorial is "<<fact; getch(); }