vb求n阶乘表达式Private Sub Command1_Click()Dim n As Integern = InputBox("请输入一个正整数: ")Print Fac(n)End SubPrivate Function Fac(m) As Long '' '请不要删除该行,只在下一行中填空' For k = 2 to Fac = Fac * kNext kEnd Function
问题描述:
vb求n阶乘表达式
Private Sub Command1_Click()
Dim n As Integer
n = InputBox("请输入一个正整数: ")
Print Fac(n)
End Sub
Private Function Fac(m) As Long
'' '请不要删除该行,只在下一行中填空'
For k = 2 to
Fac = Fac * k
Next k
End Function
答
Private Sub Command1_Click()
Dim n As Integer
n = InputBox("请输入一个正整数:")
Print Fac(n)
End Sub
Private Function Fac(m) As Long
'' '请不要删除该行,只在下一行中填空'
For k = 2 To m
Fac = Fac * k
Next k
End Function