#include
class factorial
{
int num;
public:
void getinfo()
{
cout<<"\n Enter the number for which the factorial is to be found : "; cin>>num;
}
void facto()
{
int i,fact=1;
if(num==0||num==1)
cout<<"\n Factorial of "<
{
for(i=1;i<=num;i++)
{fact=fact*i;
}
cout<<"\n Factorial of "<
}
};
void main()
{
factorial f1;
clrscr();
f1.getinfo();
f1.facto();
getch();
}
No comments:
Post a Comment