首页
技术博客
登录
6mi
u
盘
搜
搜 索
技术博客
C语言实现计算 1!+2!+3!+……+10!
C语言实现计算 1!+2!+3!+……+10!
tech
2022-09-03
133
#
include
<stdio.h>
// 计算 1!+2!+3!+……+10!
int
main
(
)
{
int
n
=
10
;
//这里输入你想结算的阶乘
int
ret1
=
1
;
int
i
=
1
;
int
j
=
1
;
int
ret2
=
0
;
for
(
i
=
1
;
i
<=
n
;
i
++
)
{
ret1
*
=
i
;
ret2
+
=
ret1
;
}
printf
(
"%d\n"
,
ret2
)
;
return
0
;
}
输出结果:
转载请注明原文地址:https://tech.qufami.com/read-4041.html
最新回复
(
0
)