用程序实现起来可以分为 计算阶乘和 计算e值两部分,其分别对应的过程如下:
计算阶乘
Private Function JC(ByVal Number As Integer) As Double
JC = 1
If Number = 0 Then
JC = 0
Else
Do Until Number = 0
JC = JC * Number
Number = Number - 1
Loop
End If
End Function
JC = 1
If Number = 0 Then
JC = 0
Else
Do Until Number = 0
JC = JC * Number
Number = Number - 1
Loop
End If
End Function
Public Function e() As Double
For n = 1 To 170
e = e + (1 / JC(n))
Next n : e = e + 1
End Function
For n = 1 To 170
e = e + (1 / JC(n))
Next n : e = e + 1
End Function