Code:
#include<iostream>
#include<conio.h>
using namespace std;
class factorial
{
private:
int n,f;
public:
void getdata()
{
cout<<" Enter a number : ";
cin>>n;
}
void fact()
{
f=1;
for(int o=n;o>1;o--)
{
cout<<"fact "<<f<<" x "<<n<<" = ";
f=f*o;
cout<<f<<endl;
n--;
}
}
};

main()
{
factorial obj;
obj.getdata();
obj.fact();
getch();
}