The code works, it compiles and works, at least for the first factorial. Then, since I have it in a loop it repeats, but the factorial that is outputted is multiplied by the previous factorial. I don't know what I'm doing wrong and it would greatly help me if someone told me, or at least pointed me towards the right direction.
#include <iostream>
usingnamespace std;
int main()
{
int n; //Input #
int f = 1; //output #
int m; //Controlls factoring
char choose; //prompt repeat
do
{
//input #
cout << "Enter a number greater than or equal to 0: ";
cin >> n;
//Mumtiplyer is one, as long as m is less
//than or equal to one it will continue to grow
// f (old m) will be multiplyed by new m
for (m = 1; m <= n; ++m)
{
f *= m;
}
cout << "Factorial of " << n << " is " << f << endl;
cout << "" << endl;
cout << "Find factorial of more numbers? y/n" << endl;
cin >> choose;
} while (choose == 'y');
return 0;
}