不知道为什么得到的结果不是3.141593,求解
#include "stdio.h"void main()
{int s;
float n,t,pi;
t=1;pi=0;n=1.0;s=1;
while(fabs(t)>1e-6)
{pi=pi+t;
n=n+2;
s=-s;
t=s/n;
}
pi=pi*4;
printf("pi=%10.6f\n",pi);
}
2013-01-13 12:49
2013-01-13 13:25
2013-01-13 14:53
2013-01-13 16:22
2013-01-21 10:11