编写程序whileforc8.c:输入任意一个整数N,输出1!+2!+……+n!的累加和;(do…while语句实现循环)# include void main(){\x09int i,p=1,n,sum=0;\x09i=1;\x09scanf("%d",&n);do\x09{ \x09 sum= sum+p;\x09 p=p*i;\x09 i++;\x09}\x09while (
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 00:51:05
编写程序whileforc8.c:输入任意一个整数N,输出1!+2!+……+n!的累加和;(do…while语句实现循环)# include void main(){\x09int i,p=1,n,sum=0;\x09i=1;\x09scanf("%d",&n);do\x09{ \x09 sum= sum+p;\x09 p=p*i;\x09 i++;\x09}\x09while (
编写程序whileforc8.c:输入任意一个整数N,输出1!+2!+……+n!的累加和;(do…while语句实现循环)
# include
void main()
{
\x09int i,p=1,n,sum=0;
\x09i=1;
\x09scanf("%d",&n);
do
\x09{
\x09 sum= sum+p;
\x09 p=p*i;
\x09 i++;
\x09}
\x09while (i
编写程序whileforc8.c:输入任意一个整数N,输出1!+2!+……+n!的累加和;(do…while语句实现循环)# include void main(){\x09int i,p=1,n,sum=0;\x09i=1;\x09scanf("%d",&n);do\x09{ \x09 sum= sum+p;\x09 p=p*i;\x09 i++;\x09}\x09while (
int sum=0,p,k,n;
int i=1;
scanf("%d",&n);
do
{
p=1;
for(k=i;k>0;k--){
p*=k;
}
sum= sum+p;
}
while (i++