Lecture 124
// Loop do while
#include <iostream>
#include <conio.h>
using namespace std;
main ()
{
system("CLS");//Clear screen
int F=1,i=1,j;
cout<<"Enter the factorial number: ";
cin>>j;
i=1;
do{
F=F*i;
i++;
}while(i<=j);
cout<<"Factorial of "<<j<<" =
"<<F;
getch();
return 0;
}
Code view in dev compiler:
Compile the program Ctrl+F9
Run program Ctrl+F10