#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();
}
VERY NCE PRGM
ReplyDeleteeasy too understand
ReplyDeleteFactorial Program in C++
ReplyDeletein c++ you can easily write Factorial of any number, it is the product of an integer and all the integers below it for example factorial of 5 is
5! = 5 * 4 * 3 * 2 * 1 = 120. factorial program in c++ is very simple and easy.
Factorial Program in C++
ReplyDeletein c++ you can easily write Factorial of any number, it is the product of an integer and all the integers below it for example factorial of 5 is
5! = 5 * 4 * 3 * 2 * 1 = 120. factorial program in c++ is very simple and easy.