#include<iostream>
#include <iomanip>
using namespace std;
int main() {
	cout << "n! \n";
	cout << "To exit => n<0 \n\n";
	while (true) {
		int n;
		cout << "n = ";
		cin >> n;
		if (n<0) {
			cout << "The program is terminated. Bye!";
			break;
		} else {
			double f = 1;
			for (int i=2; i<n+1; i++) {
				f *= i;
			}
			cout << n << "! = " << fixed << setprecision(0) << f << endl << endl;
		}	
	}
	return 0;
}
