求'Vb代码,急,1-1/2+1/3-1/4+1/5-1/6+.1/(n-1)-1/n求n=100的时候的和,

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 15:57:55
求''Vb代码,急,1-1/2+1/3-1/4+1/5-1/6+.1/(n-1)-1/n求n=100的时候的和,求''Vb代码,急,1-1/2+1/3-1/4+1/5-1/6+.1/(n-1)-1/n求n

求'Vb代码,急,1-1/2+1/3-1/4+1/5-1/6+.1/(n-1)-1/n求n=100的时候的和,
求'Vb代码,急,1-1/2+1/3-1/4+1/5-1/6+.1/(n-1)-1/n求n=100的时候的和,

求'Vb代码,急,1-1/2+1/3-1/4+1/5-1/6+.1/(n-1)-1/n求n=100的时候的和,
Private Sub Command1_Click()
Dim d As Double, s As Double
d = 1
For i = 1 To 100
If i Mod 2 0 Then
s = s + d / i
Else
s = s - d / i
End If
Next

End Sub