Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int input;
- char action;
- do
- {
- cout << "Do you want to continue? (Y/N)?" << endl;
- cin >> action;
- if (!cin.good())
- {
- cout << endl << "Rip" << endl;
- return 1;
- }
- if (action == 'y' || action == 'Y')
- {
- }
- if (input == -999)
- {
- cout << endl << "Exiting" << endl;
- return 0;
- } else
- {
- int result = 1;
- for (int i = 0; i < input; i++)
- result *= i + 1;
- cout << "The factorial of " << input << " is: " << result << endl;
- }
- } while (input != -999);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement