Thursday, 19 June 2014

Write a program to find a factorial of an integer.








PROGRAM TO FIND FACTORIAL OF AN INTEGER



#include<iostream.h>
#include<stdlib.h>
int main()
{
int i,num,fact =1;
cout<< "\n Enter integer : ";
cin>>num;
i = num;
while(num)
{
fact*=num;
--num;
}
cout<<" The factorial is";
cout<<fact;
return 0;
}





OUTPUT


Enter the integer : 5
The factorial is 120


CLICK HERE FOR PROGRAMS LISTS

No comments:

Post a Comment