VB表达式:计算S=1+1/2+1/4+1/7+1/11+1/16+1/22+1/29+···当第i项的值

问题描述:

VB表达式:计算S=1+1/2+1/4+1/7+1/11+1/16+1/22+1/29+···当第i项的值

Private Sub Command1_Click()
Dim i As Long
Dim a As Double
Dim s As Double
Dim stp As Integer
stp = 1
i = 1
Do While True
If 1 / i a = 1 / i
s = s + a
i = i + stp
stp = stp + 1
Loop
Print s
End Sub