1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream> using namespace std; int factorial(int n){ int res =1 ; for(int i=2; i<=n;i++) res*=i; return res; } int main() { int n; cin >> n; int res = factorial(n); cout << res << endl; return 0;
1 2 3
In function 'int main()': Line 15: error: expected `}' at end of input compilation terminated due to -Wfatal-errors.