Welcome..!!

Please visit http://csprograms.in/ for more Computer Science programs.

Tuesday 13 March 2012

4. C++ program to find factorial of a given number.



#include <iostream>
int main()
{
int i,f,n;
f=1;
cout <<"Enter the number \n";
cin >>n;
for(i=1;i<=n;i++)
f=f*i;
cout <<"Factorial of  "<<n <<" is  "<<f;
return 0;
}

No comments:

Post a Comment