Write a C++ program to calculate factorial of a number.
#include <iostream>
using namespace std;
int main() {
// #ifndef ONLINE_JUDGE // not part of code, used to beautify input output
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
int n, i, fact;
cin >> n;
fact = n;
for (i = 1; i < n; i++) {
fact = fact * (n - i);
}
cout << fact;
return 0;
}