求大神指点错误 刚学c很头疼
题目是sum=1+1/2-1/3+1/4-1/5,,,,,,,+1/100#include <stdio.h>
int main()
{
int s=1;
float a=3,b=4,m=1,n=1/2,x,y,z;
x=s/a;//x=1/3,y=1/4 a5 b6 a7 b8
y=s/b;
while(a<=99&&b<=100)
{
a=a+2;
b=b+2;
m=m-x;//1-1/3
n=n+y;//1/2+1/4
}
z=m+n;
printf("%f\n",z);
return 0;