用VB怎样求1~10的阶乘
的有关信息介绍如下:在VB中求阶乘的部分代码:
Private Function fact(m As Integer) As Long
Dim i As Integer
fact = 1
For i = 1 To m
fact = fact * i
Next i
End Function
Private Sub Command1_Click()
Dim n As Integer, sum As Long
Dim i As Integer
n = Val(Text1.Text)
For i = 1 To
扩展资料:
1~10的阶乘的结果如下:
1!=1
2!=2*1=2
3!=3*2*1=6
4!=4*3*2*1=24
5!=5*4*3*2*1=120
6!=6*5*4*3*2*1=720
7!=7*6*5*4*3*2*1=5040
8!=8*7*6*5*4*3*2*1=40320
9!=9*8*7*6*5*4*3*2*1=362880
10!=10*9*8*7*6*5*4*3*2*1=3628800