#include
#include
int main()
{double pi=1,t=0;
for(;t<1.9999999;)
{t=sqrt(2+t);
pi*=2/t;
}
printf("%lf\n",pi*2);
return 0;
}
#include "math.h"
float pi(){
float l = sqrt(2);
float lp = 0;
float p = 4.0 / l;
while (fabs(p - lp) > 1e-6) {
l = sqrt(2+l);
lp = p;
p = 2*p/l;
}
return p;
}
int main()
{
printf("%f", pi());
return 0;
}