求教一道简单的VB题,直到最后一项的绝对值小于10-5为止.1-1/(1*2)+1/(2*3)-不知道哪里错了Private Sub Command1_Click()Dim a As Double,i As Integer,s As Singlef = -1i = 1Doa = 1 / (i * (i + 1))s = 1 + f * ai = i + 1f = -
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 09:39:16
求教一道简单的VB题,直到最后一项的绝对值小于10-5为止.1-1/(1*2)+1/(2*3)-不知道哪里错了Private Sub Command1_Click()Dim a As Double,i As Integer,s As Singlef = -1i = 1Doa = 1 / (i * (i + 1))s = 1 + f * ai = i + 1f = -
求教一道简单的VB题,直到最后一项的绝对值小于10-5为止.1-1/(1*2)+1/(2*3)-
不知道哪里错了Private Sub Command1_Click()
Dim a As Double,i As Integer,s As Single
f = -1
i = 1
Do
a = 1 / (i * (i + 1))
s = 1 + f * a
i = i + 1
f = -f
Loop Until Abs(a) < 10 ^ (-5)
Print s
End Sub
求教
求教一道简单的VB题,直到最后一项的绝对值小于10-5为止.1-1/(1*2)+1/(2*3)-不知道哪里错了Private Sub Command1_Click()Dim a As Double,i As Integer,s As Singlef = -1i = 1Doa = 1 / (i * (i + 1))s = 1 + f * ai = i + 1f = -
Private Sub Command1_Click()
Dim a As Double,i As Long,s As Single
f = -1
i = 1
Do
a = 1 / (i * (i + 1))
s = 1 + f * a
i = i + 1
f = -f
Loop Until Abs(a) < 10 ^ (-5)
Print s
End Sub