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
290 B
17 lines
290 B
2 years ago
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int f(int n) {
|
||
|
int res = 1;
|
||
|
for (int i = 1; i <= n; i++) res *= i;
|
||
|
return res;
|
||
|
}
|
||
|
|
||
|
int main() {
|
||
|
int s = 0;
|
||
|
// 1!+2!+3!+4!+5!
|
||
|
for (int i = 1; i <= 5; i++) s += f(i);
|
||
|
cout << s << endl;
|
||
|
return 0;
|
||
|
}
|