计算圆周率PI=4-4/3+4/5-4/7.........打印出第一个大于3.1415小于3.1416的值
发布网友
发布时间:2022-05-12 20:42
我来回答
共1个回答
热心网友
时间:2023-10-22 00:29
3.14150000952847 用vb6.0编程如下
Private Sub Command1_Click()
a = 1
b = 4
For i = 3 To 1000000000 Step 2
b = b + (4 / i) * (-1) ^ a
a = a + 1
If b > 3.1415 And b < 3.1416 Then Exit For
Next i
Text1.Text = b
End Sub