1-1_2 1_3-1_4………… 1_99-1_100的多种解法
文章作者 100test 发表时间 2007:03:10 17:21:25
来源 100Test.Com百考试题网
方法一:
For i = 1 To 100
If i Mod 2 = 0 Then
s = s - 1 / i
Else
s = s 1 / i
End If
Next i
方法二:
k = 0
For a = 1 To 99 Step 2
s = 1 / a - 1 / (a 1)
k = k s
Next a
MsgBox (k)
方法三:
For i = 1 To 100
s = s (-1) ^ (i 1) * (1 / i)
Next i
Text1.Text = s
方法四:
Private Sub Form_Load()
s = 0
For i = 1 To 100
s = s 1 / i
Next i
For a = 2 To 100 Step 2
b = b 1 / a
Next a 请往下看
c = s - 2 * b
MsgBox (c)
End Sub
方法五:
a = 1
s = 0
For i = 1 To 100
a = (-1) ^ (i 1) / i
s = s a
Next i
MsgBox (s)
方法六:
s=0
for i=1 to 100
s=s (1/i)*(-1)^((i 1) mod 2)
next i