编写程序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/12/23 01:27:55
编写程序whileforc8.c:输入任意一个整数N,输出1!+2!+……+n!的累加和;(do…while语句实现循环)#includevoidmain(){\x09inti,p=1,n,sum=0
编写程序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++