C语言自学,为什么我编的程序不能正确执行,求教,题目是求pi.
#include<stdio.h>#include<math.h>
int main()
{
int sign=1,n=1,count=1;
double pi=1.0,m;
while(fabs(m)>=1e-6)
{
sign=-sign;
n=n+2;
m=sign/n;
pi=pi+m;
count++;
}
pi=pi*4;
printf("pi=%10.8f\n",pi);
printf("count=%d\n",count);
return 0;
}