//C语言实现如下:
double binary_PI(int n)
{
double result = 1.0;
int i = 0;
for (i=1; i<=n; i++)
result *= (1.0+1.0/((2*i-1)*(2*i+1)));
return result;
}
int main()
{
int n = 200;
printf("PI/2 = %lf\n", binary_PI(n));
return 0;
}
运行结果:
希望对您有所帮助!!