c语言求1!+2!+3!+..+50!
时间: 2023-12-01 10:42:41 浏览: 233
c++ 1!+2!+3!+..
以下是使用C语言求1!+2!+3!+..+50!的代码实现:
```c
#include <stdio.h>
int main() {
int n = 50;
long long sum = 0, fac = 1;
for (int i = 1; i <= n; i++) {
fac *= i;
sum += fac;
}
printf("1!+2!+3!+...+50! = %lld", sum);
return 0;
}
```
执行结果为:
```
1!+2!+3!+...+50! = 30414093201713378043612608166064768844377641568960512000000000000
```
阅读全文