[求助]我写的代码哪里有问题啊?
编写计算1!+2!+3!+……n!的Sub过程,在窗体的Click事件中调用该过程,输出计算结果。我写的代码:
哪里有问题啊?
Sub factS(ByVal n As Integer, fac)
fac = 1
For i = 1 To n
fac = fac * i
Next i
End Sub
Private Sub Form_Click()
Dim a As Integer, b As Integer, sum As Double
a = Val(InputBox("输入项数"))
b = 0
For i = 1 To a
b = b + 1
Call factS(a, fac)
sum = sum + fac
Next i
Print fac;
End Sub