You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
289 B

#include <bits/stdc++.h>
using namespace std;
long long factorial(int n) {
if (n == 1) return 1;
return n * factorial(n - 1);
}
int main() {
long long s = 0;
for (int i = 1; i <= 20; i++)
s += factorial(i);
cout << s << endl;
return 0;
}