Friday 16 November 2012

Factorial of Given Number.


#include <iostream>
using namespace std;
int main()
{
int num,fact=1;
cout << "Enter Integer to get Factorial: ";
cin >> num;
/*cout << "Enter Length of the Table: ";
cin >> length;*/
for (int i=num;i>=1;i--)
{
fact=fact*i;
}
cout << "Factorial of " << num << " is = " << fact <<endl;
return 0;
}

No comments:

Post a Comment