#include <iostream.h>
#include <conio.h>
void main ()
{
int n;
long int fact;
cout << "Enter any number which you want to printout it's factorial ";
cin >> n;
fact = 1;
for ( ; n>=1; n--)
fact = fact * n;
cout << fact ;
getch ();
}
for example:
if you enter 5
it's answer will be: 5*4*3*2*1 = 120
Output:
Enter any number which you want to printout it's factorial 5
120
Keep it up bro...
ReplyDelete