Work out 1! + 2! + 3! + … + 20! and show it. For the first 3 terms: 1 + 2 + 6 = 9. No need to multiply from 1 for each term: i! is just (i−1)! times i. In the starter, f holds the factorial of the last term and sum holds the total.
2561327494111820313
#include <stdio.h>
int main(void) {
long long sum = 0, f = 1;
for (int i = 1; i <= 20; i++) {
// your code here: turn f into i!, then add it to sum
}
printf("%lld\n", sum);
return 0;
}
Run tries the examples. When they look right, Submit.