程序运行时,在文本框Text1中输入n的值,单击命令按钮Command1后,调用函数f计算s=1!
1个回答
展开全部
Private Sub Command1_Click()
Text3.Text = f(Val(Text1.Text))
End Sub
Function f(n As Integer) As Long
Dim i As Integer, j As Integer, l As Long, m As Long
m = 0
For i = 1 To n
l = 1
For j = 1 To i
l = l * j
Next
m = m + l
Next
f = m
End Function
Text3.Text = f(Val(Text1.Text))
End Sub
Function f(n As Integer) As Long
Dim i As Integer, j As Integer, l As Long, m As Long
m = 0
For i = 1 To n
l = 1
For j = 1 To i
l = l * j
Next
m = m + l
Next
f = m
End Function
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询