#include <iostream>
#include <conio.h>
using namespace std;
int calc (int x)
{
if (x==1)
{
return 1;
}
else
{
return (x * calc (x-1));
}
}
class factorial
{
private :
int number,fact,temp;
public :
void input ();
void proses ();
void output ();
}
int main ()
{
factorial f;
f.input ();
f.proses ();
f.output ();
getche ();
return 0;
}
void factorial :: input ()
{
cout << "input number = ";
cin >> number;
temp = number;
}
void factorial :: proses ()
{
fact = calc (temp);
}
void factorial :: output ()
{
cout << "factorial of " << number << " = " << fact;
}