你给的公式不对!应该是π/2=2^2/1*3 ×4^2/3*5 ×。。。×(
这个公式求的精度不高!代码如下:
Dim PI1 As Double
Dim PI2 As Double
Dim Temp As Double
Dim n As Double
PI1 = 0: PI2 = 2: n = 2
While PI2 - PI1 > 0.000001
PI1 = PI2
Temp = (n * n) / ((n - 1) * (n + 1))
PI2 = PI2 * Temp
n = n + 2
Wend
Me.Text1.Text = PI2