大家看看这个对不对啊
#include<stdio.h>#include<math.h>
int main()
{
float f;
while(scanf("%f",&f) != EOF)
{
int sign=1;
double pai=1.0,n=1.0,term=1.0;
while(fabs(term)>=f)
{
n=n+2;
sign=-sign;
term=sign/n;
pai=pai+term;
}
pai=pai*4;
printf("%.6lf\n",pai);
}
return 0;
}