Hello,
Here is the program:
------------------------
#include <iostream>
using namespace std;
int main ()
{
int factorial;
cout<<"Enter a positive integer: ";
cin>>factorial;
for ( int x=factorial; x>1 ; x-- )
{
factorial = factorial * (factorial-1);
}
cout<<"The factorial is: "<<factorial<<endl;
return 0;
}
------------------------
What is wrong?
I got (as an example) 4!=17292 which clearly wrong. 4! should be 24.
Please what is wrong!
I got a headache!