,谢谢,是2!+4!+6!+8!+10!+12!+14!。。不是1!+......+20!
追答#include "stdio.h"
#include "stdlib.h"
double fun(double a)
{
if(a==0||a==1)
return 1;
else
return a*fun(a-1);
}
int main()
{
int i;
double sum;
for(i=2,sum=0;i<=14;i=i+2)
sum+=fun(i);
printf("2!+4!+6!+8!+10!+12!+14!=%.0lf\n",sum);
system("pause");
return 0;
}
sorry,我搞错了,应该是这个,
用C语言编写函数求 2!+4!+6!+8!+10!+12!+14!
for(int number=2;number<=14;number+=2)result+=Factorial(number);printf("2!+4!+6!+8!+10!+12!+14!=%d\\n",result);}
用C语言编写函数求2!+4!+6!+8!+10!
int i,s=0,p;for(i=2;i<10;i+=2){ p=1; 此处要注意,每进行一次阶层运算,就要从1开始累乘。for(j=1;j<=i;j++)p=p*j;s+=p;} 此题是累加累乘类题目,主要关注的是循环的变量关系。还有最基本的算法。很高兴为你解答。请问还有什么疑问吗?
c语言 计算双阶乘之积:2!!+4!!+6!!+8!!+……+14!!=?
include<stdio.h> main(){ int i,j;long sum,n;for(i=2,sum=0;i<=14;i+=2){ for(n=1,j=2;j<=i;j+=2){ n*=j;} sum+=n;} printf("%ld\\n",sum);}
用C语言编写函数求2!+4!+6!+8!+10
答案如下:include <stdio.h> int fun(int n){ int sum = 1;while(n >= 1){ sum = sum * n;n = n - 1;} return sum;} int main(){ int n = 0,tmp = 0;;for(n = 2;n <= 10;n = n + 2){ tmp = tmp + fun(n);} printf("tmp = %d\\n",tmp);} 如果是10...
用C语言编写函数求2!+4!+6!+8!+10
;s初值置0,累加每个n当前值时的阶乘t,就完成了题设要求。代码如下:include "stdio.h"int main(int argc,char *argv[]){ int s,n,t;for(s=0,t=n=1;n<11;s+=t*=n++);\/\/用t记录每个n的当前值的阶乘并累加到s printf("1!+2!+3!+...+10! = %d\\n",s); return 0;} ...
编程实现,求和s=2!+4!+6!+8!+10!。要c语言的,求指教啊!
{int fac(int n );int s ;s=fac(2)+ fac(4) +fac(6)+ fac(8)+ fac(10);printf ("2!+4!+6!+8!+10!=%d\\n ",s );return 0;} int fac(int n ){int f;if (n <0)printf ("n <0,data error !");else if (n==0||n==1)f=1;else f=fac(n-1)*n;...
用C语言求阶乘2!+4!+6!+8!+10!
include "stdio.h"main(){ int i,k;double s,t=0;for(i=2;i<=10;i+=2){ s=1;for(k=1;k<=i;k++) s=s*k;t+=s;} printf("2!+4!+6!+8!+10!=%lf",t);
...在主函数中用for循环计算s=2!+4!+6!+8!+10!,怎么编程?
代码文本:include "stdio.h"int main(int argc,char *argv[]){ int s,n,t;for(t=1,s=0,n=2;n<11;s+=(t*=n*n-n),n+=2);printf("2!+4!+6!+8!+10! = %d\\n",s);return 0;}
c语言编程 求阶乘2!+4!+6!+…12!。
include<stdio.h> int main(){ int n,i,sum=0,m=1;scanf("%d",&n);for(i=1;i<=2*n;i++){ m*=i;if(i%2==0)sum+=m;} printf("%d",sum);return 0;}
求助、求助 c语言 编程求2+4+6+8+...n n值从键盘输入 谢谢大侠们_百度...
include <stdio.h> int main ( ){ int i,j,sum;sum=0;printf("请输入一个整偶数!\\n");scanf("%d",&j);for(i=2;i<=j;i+=2){ sum=sum+i;} printf("sum=%d\\n",sum);return 0;}