#include double sum(int n){
int i,t; double s=0; while(i<=n) { t=-t; s+=1./(t*i); i=i+2; } return s;
}main(){ int n; scanf("%d",&n); printf("sum=%f\n",sum(n));}
i定义的时候要初始化为0
t要赋值吧