#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main()
{
double a,low;
int i;
double x,y,ans;
a=low=1.0;
x=1;
while(fabs(a/low)>=0.0000001)
{
a=-a;
low=low+2;
x=x+a/low;
}
ans = 4.0*x;
printf("%.6lf\n",ans);
return 0;
}
NOJ:计算Π
最新推荐文章于 2022-12-12 12:59:59 发布