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.

20 lines
317 B

#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int T;
int sum = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
T = 1;
for (int j = 1; j <= i; j++) {
T *= j;
}
sum += T;
}
cout << sum << endl;
return 0;
}