I am having difficulties writing the program.
the program should ask user for a positive integer and print a factorial table.
for example -
Give me a positive integer: 5
1! = 1 = 1
2! = 2 x 1 = 2
3! = 3 x 2 x 1 = 6
4! = 4 x 3 x 2 x 1 = 24
5! = 5 x 4 x 3 x 2 x 1 = 120
int s, factorial = 1;
cout << "Enter a positive integer: ";
cin >> s;
while (s < 0)
{
cout << "Enter positive integer only: ";
cin >> s;
}
for (int r = 1; r <= s; r++)
{
factorial *= r;
for (int c =1; c <= r; c++)
{
// what goes here?
}
cout << endl;
}
need some clues.