用vb语言计算1!+2!+3!+…+10!,其中阶乘的计算分别用过程和函数实现.
问题描述:
用vb语言计算1!+2!+3!+…+10!,其中阶乘的计算分别用过程和函数实现.
答
Private Sub Command1_Click()
Dim i As Integer
For i = 1 To 10
Sum = Sum + jc(i)
Next
MsgBox Sum
End Sub
Function jc(a As Integer)
jc = 1
For i = 1 To a
jc = jc * i
Next
End Function