求C的源程序,1!+2!+3!+4!+5!,要求运用到静态变量和动态变量的
#include <stdio.h>
int fun(int n)
{static int k=1;
k*=n;
return k;
}
int main( )
{int i,s=0;
for(i=1;i<6;i++)
s+=fun(i);
printf("%d\n",s);
return 0;
}
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/8718367adab44aed2b318bbfb91c8701a18bfb69?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
温馨提示:答案为网友推荐,仅供参考
相似回答
用C语言编写答:strcpy(p->sc.chinese, c); readstr(fp, c); strcpy(p->sc.english, c); readstr(fp, c); strcpy(p->sc.math, c); readstr(fp, c); strcpy(p->sc.physics, c); readstr(fp, c); strcpy(p->pe.name, c); readstr(fp, c); strcpy(p->pe.sex, c); readstr(fp, c); strcpy(...