This is my program. I get no compiling errors but the output is way to high.
Code:
// My first factorial program
#include <iostream>
using namespace std;
int main ()
{
int start = 0;
while (start == 0)
{
int N;
int X;
char choice;
unsigned long int answer;
cout << "I am the Factorial program.\n Which number's factorial do you want?\n";
cin >> N;
cout << "The factorial of "; cout << N << " is "; cout << answer << endl;
answer = N;
X = 1;
while ( N - X > 1)
{
answer = answer * (N - X);
X = X + 1;
}
cout << "This is the end of this program.\n Do you wish to use this program again ( yes (y) or no (n))?\n";
cin >> choice;
if (choice == 'y' || choice == 'Y')
{
}
if (choice == 'n' || choice == 'N')
{
start = 1;
}
}
int end;
cin >> end;
return EXIT_SUCCESS;
}