计算一个数学表达式
我是初学者,很简单的数学表达式:2!+4!+6!+8!+10!+12! ,但是怎么运行起来就动不了?不知道哪里错了.
代码:
Private Sub Command6_Click()
Dim x As Integer, i As Long
i = 0
x = 2
Do While x <= 4
i = i + jx(x)
x = x + 2
Loop
Print i
End Sub
Private Function jx(z As Integer)
Dim y As Integer
If z <= 0 Then
MsgBox "数值错误!"
End If
y = z
Do While z > 1
z = z - 1
y = y * z
Loop
jx = y
End Function