'窗体上一个文本框,一个按钮,复制以下代码
Private Sub Command1_Click()
s = 1
n = Val(Text1.Text)
If n Mod 2 = 0 Then
For i = 2 To n Step 2
s = s - 1 / i
Next k
Else
For i = 3 To n Step 2
s = s - 1 / i
Next k
End If
MsgBox s
End Su
'窗体上一个文本框,一个按钮,复制以下代码
Private Sub Command1_Click()
s = 1
n = Val(Text1.Text)
If n Mod 2 = 0 Then
For i = 2 To n Step 2
s = s - 1 / i
Next k
Else
For i = 3 To n Step 2
s = s - 1 / i
Next k
End If
MsgBox s
End Su