Sunday, 24 March 2013

C++ Factorial Simple Program


#include<iostream>
#include<conio.h>

using namespace std;

void main()
{
int fact;
int result= 1;

cout<<"Enter Number to find Factorial = "; cin>>fact;

int i=fact;  //i = 5
for(int i=fact;i>1;i--)
{
fact = fact * (i-1);
cout<<fact<<",";
}
_getch();

}