by irfanmasiullah » Wed Apr 14, 2010 6:09 am
Hello Mr. Rohit,
Thanks for the program, but I have some comments after execution.
This program is not calculating correct answer after 10 because value is getting hence I use "double" variable instead of int for factorial.
Find below my program in C++ , I appreciate comments....
/* Program to fing Factorial number*/
#include <iostream>
#include <cmath>
int main ()
{
int n; /* n= Given number for which we want factorial */
double f=1; /* f= factorial number */
using namespace std;
cout << "Please Enter the Number for which you want Factorial ?? " << endl;
cin >> n;
while (n!=0)
{
f=f*n;
n=n-1;}
cout << "Factorial is "<< f << endl;
system ("pause");
return 0;
}