运行结果不正确。
程序代码:
#include<stdio.h>
#include<math.h>
int main()
{
int n=3,sign=1;
float PI=1.0,term;
while(fabs(term) >= pow(10,-6))
{
sign=-1*sign;
term=sign/n;
n=n+2;
PI=PI+term;
}
printf("PI=%6.5f",PI*4);
return 0;
}
这题是求π值的。
π/4=1-1/3+1/5-1/7+…
大神帮我查看下哪里出错了。Thank you!









