菜鸟求助!!!急!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
请问以下两个代码有什么区别,为什么结果不一样?1.
Private Sub Form_Click()
Dim n&, i!, s!, k%
n = 1
s = 0
k = 1
i = 1
Do
s = s + k * i
k = k * (-1)
n = n + 1
i = i / n
Loop Until i < 0.000001
Print s
End Sub 结果为0.6321208
2.
Private Sub Form_Click()
Dim n&, s!, k!, i!
n = 0
s = 0
i = 1
Do
n = n + 1
i = i / n
k = (-1) ^ (n - 1) * i
s = s + k
Loop Until i < 0.000001
Print s
End Sub 结果为0.6321205