递归调用求阶乘,请帮我看错在哪
Public Sub km(N As Integer)Dim m As Integer
If N > 1 Then
m = N * km(N - 1)
Else
km(1) = 1
End If
Print shr$(N) & "的阶乘是:" & Str$(m)
End Sub
Private Sub Form_Load()
Dim num As Integer
num = InputBox("enter a number from 0 to 20 or -1 to end:")
If num > 0 And num <= 20 Then
km num
End If
End Sub