#include<iostream.h>
#include<conio.h>
class Fact
{
int n;
public :
void getData()
{
cout<<"\n Enter value of n : ";
cin>>n;
}
void putData();
};
void Fact::putData()
{
int i,f=1;
for(i=1;i<=n;i++)
{
f=f*i;
}
cout<<"\n Factorial of "<<n<<" is "<<f;
}
int main()
{
clrscr();
Fact f;
f.getData();
f.putData();
getch();
return 0;
}
No comments:
Post a Comment