VB里,编写求fac(n)=n!的函数,n值由文本框1输入,调用函数,求得结果输出到文本框2

日期:2011-05-26 14:38:30 人气:1

VB里,编写求fac(n)=n!的函数,n值由文本框1输入,调用函数,求得结果输出到文本框2

Private Sub Command1_Click() Dim n As Integer n = Val(Text1.Text) Text2.Text = Str(fac(n)) End Sub Private Function fac(n As Integer) As Long Dim i As Integer Dim sum As Long sum = 1 For i = 1 To n sum
    A+
热门评论