python

QLxie2023 发表于 5个月前 · 关联问题 π 值计算

x=0 s=1 a=1 while a/4 > 0.0001:

x += (-1)**(s+1)*a s += 1 a = 1/(2*s-1)

x = 4*x print(x)