# Factorization Problem

Hey,
I have a bit of a problem here, and is a 50pts problem for college...
Is not that hard but ive beaten myself to death with it, and cant come up with it.

The professor gave us a few hints to make a program that factorizes a number until lvl 5.
i came up with this:

# include
using std::fixed;
using std::cout;
using std::endl;
using std::cin;
# include
using std::setprecision;
int main()
{
long double factorial=1;
int counter=1,numero;
cout<<"Input a number:";
cin>>numero;
while(counter<=numero)
{
factorial=factorial * counter;
counter=counter + 1;
}
cout<<"The Factorial of"<<numero<<"is:"<<fixed<<setprecision(0)<<factorial<<endl;
return 0;
}

This factorizes example 5 to 120.
But now i have to find a way that it displays the whole process of the factorization.
Example i need it to display (with number 5)
1*1=1
1*2=2
2*3=6
6+4=24
24*5=120
and stops in lvl 5.
if anyone can help me or point me in the right direction, please it would be most appreciated.

• However, it works...
[code]
# include
using std::fixed;
using std::cout;
using std::endl;
using std::cin;

# include
using std::setprecision;

int main()
{

long double factorial =1;
int counter,
numero;

cout << "Input a number : ";
cin >> numero;

for(counter=2; counter<=numero; counter++)
{
cout << factorial << '*' << counter << '=';
cout << (factorial *= counter) << endl;;
}

cout << "
The Factorial of " << numero << " is:" << fixed << setprecision(0) << factorial << endl;

system("pause");
return 0;
}
[/code]
• Thnx bro!
It worked perfectly!
Im new @ this, but i seriously searched quite a while in internet and couldnt find any good hints.
Srry for the bother.

Thnx again!