Private Sub Form_Click()
Dim n As Integer
n = InputBox("N=")
s = 0
f = 1
For i = 1 To n
f = f * i
s = s + f
Next i
Print "N="; n
Print "Sum="; s
End Sub
Public Function jiecheng(ByVal n As Integer) As Integer
Dim jc As Integer = 1
For i = 1 To n
jc = jc * i
Next
Return jc
End Function
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim str As String = ""
Dim sum As Integer = 0
For i = 1 To 5
sum = sum + jiecheng(i)
Next
TextBox6.Text = sum
End Sub