int jiecheng(int n)if(n==0 ||n==1)return 1;}elsereturn n*jiecheng(n-1);}}int sum=0;for(int i=1;i<n;i++)if(i%2==0)sum+=i;}}私心想着好歹改改便可以给楼主交差,可一看程序,真真是不行滴~~,我只有给楼主多改了改,这次必定是极好的。至于如何防止溢出,尽量不要算那么大的数,应该就可以了吧,我碰到的溢出问题不多。程序如下,请笑纳~~~如果还有何疑问,请尽管问~~~#include<stdio.h>int main() int i,j; int a[100],sum=0,n; scanf("%d",&n); for(i=0;i<n;i++) for(j=1;j<=i+1;j++) if(j==1) a[i]=1; else a[i]*=j; } } for(i=0;i<n;i++) sum+=a[i]; printf("%d\n",sum); return 0;}unsigned int factorial(unsigned int n) unsigned int i; unsigned int val = 1; for(i=1; i<=n; i++) val *= i; } return val;}unsigned int xxx(unsigned int n) unsigned int i; unsigned int val = 0; for(i=2; i<=n; i+=2) val += i; } return val;}