> 数学 >
VB表达式:计算S=1+1/2+1/4+1/7+1/11+1/16+1/22+1/29+···当第i项的值
人气:118 ℃ 时间:2020-03-20 01:56:44
解答
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 < 10 ^ -4 Then Exit Do
a = 1 / i
s = s + a
i = i + stp
stp = stp + 1
Loop
Print s
End Sub
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版