vb 编程 用pi /4 =1-1/3+1/5-1/7+...公式求pi的近似值,直到最后一项绝对值小于10-6为止Dim pi As Double, i As Integer, x As Long x = 1 i = 1 While 1 / x > 10 ^ -6 pi = pi + i * (1 / x) i = -1 x = x + 2 Wend Print pi * 4 我是菜鸟 求指教 请问哪儿错了?
问题描述:
vb 编程 用pi /4 =1-1/3+1/5-1/7+...公式求pi的近似值,直到最后一项绝对值小于10-6为止
Dim pi As Double, i As Integer, x As Long
x = 1
i = 1
While 1 / x > 10 ^ -6
pi = pi + i * (1 / x)
i = -1
x = x + 2
Wend
Print pi * 4
我是菜鸟 求指教 请问哪儿错了?
答