#include "stdio.h" float sum(int n) { float s,f=0; int i,j; /Program/ for(i=2;i<=n;i+=2){ int factorial=1; for(j=1;j<=i;j++){ factorial*=j; } f+=factorial; } s = f; /********** End **********/ return s; } main() { printf("sum=%f\n",sum(10)); }

3、题目:编写函数求2!+4!+6!+8!+10!。结果为3669866。------------------------------------------------------------------------注意:部分源程序给出如下。请勿改动主函数main或其它函数中给出的内容仅在 Program-End之间删除【】填入若干语句。不要删除标志否则不得分。------------

原文地址: https://www.cveoy.top/t/topic/ie06 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录