You are on page 1of 1

Dietel and Dietel Exercise Solution 2.

38
============================================
#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
int input;
cout<<"Enter a number:";
cin>>input;

//////////////////////////////calculating factorial
int temp=1;
for(int i = 1; i <= input; i++)
{
temp = temp * i;
}
//////////////////////////////
cout<<"Factorial of "<<input<<" is: "<<temp<<endl;

return 0;
getch();
}

http://www.ravianeducation.blogspot.com
FARHAN: 03008855006