C语言,求S=1/1!+1/2!+1/3!+…+1/N!

日期:2009-05-06 13:40:45 人气:1

C语言,求S=1/1!+1/2!+1/3!+…+1/N!

#include main() { int n,s=0; sum(1,1, n); scanf("%d",&n); s=sum(n); printf("%d\n",s); getch(); } sum(int x,int y,int n) { int z;z=0; for(x=1;x<=n;x++) {for(y=1;y<=x;y++) z+=y; } return (z); }
    A+
热门评论