当前位置:首页 > C > 正文内容

编程序求1!+2!+…+n!

2023-12-01C

编程序求1!+2!+…+n!

#include int main() {int i,n,t=1,s=0;printf("n=");scanf("%d",&n);for(i=1;i<=n;i++){t=t*i;s=s+t;}printf("1!+2!+…+n!=%d\n",s);return 0;}

扫描二维码免费使用微信小程序搜题/刷题/查看解析。

版权声明:本文由翰林刷题小程序授权发布,如需转载请注明出处。

本文链接:https://www.20230611.cn/post/8758481.html