1-1/22+1/32-1/42...-1/1002

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 00:35:58
1-1/22+1/32-1/42...-1/10021-1/22+1/32-1/42...-1/10021-1/22+1/32-1/42...-1/1002#includefloatf(inti){i

1-1/22+1/32-1/42...-1/1002
1-1/22+1/32-1/42...-1/1002

1-1/22+1/32-1/42...-1/1002
#include float f(int i) { if(i=1) return 1; if(i>1) return 1/(i*10+2); } void main() { float s=0; int j; for(int i=1;i<=100;i++) { j=((-1)^(i+1))*i; s=s+f(j); } printf("%d/n",s); }