新手求助!! 这个程序为什么输出结果是错误的?
求a = 1 - 1/3 + 1/5 - 1/7 + 1/9......直到被除数小于10的-6次方为止 为什么输出结果是-92559631349317831000000000000000000000000000000000000000000000.000000
# include <stdio.h>
int main(void)
{
int i, j = 0;
double a;
for (i = 1;i <= 1e6;i++)
{
if (i%2 == 0)
continue;
else
j++;
if (j%2 == 0)
a -= 1.0/(double)i;
else
a += 1.0/(double)i;
}
printf("%.6lf\n", a);
return 0;
}