编程实现计算s=1+1/2!+1/3!+......+1/n!直到1/n!小于0.00001为止
Private Sub form_click()
Dim a As Integer, n As Integer
Dim s As Double, b As Double, c As Double
s = 0
b = 1
For a = 1 To n
b = b * a
c = 1 / b
s = s + c
If c < 0.00001 Then
Print s
Exit For
End If
Next a
End Sub
哪里出错了?
Private Sub form_click()
Dim a As Integer, n As Integer
Dim s As Double, b As Double, c As Double
s = 0
b = 1
For a = 1 To n
b = b * a
c = 1 / b
s = s + c
If c < 0.00001 Then
Print s
Exit For
End If
Next a
End Sub
哪里出错了?