Sunday, 31 August 2014

Factorial of an Integer

#include"stdafx.h"
#include<iostream>
using namespace std;
int main()
{
long int num;
int i=1,fact=1;
cout<<"Enter an integer:";
cin>>num;
while(i<=num)
{
fact=fact*i;
i++;
}
cout<<"Factorial of number is : "<<fact<<"\n";
return 0;
}

No comments:

Post a Comment