vb中1到n的階乘之和公式?
在窗體上放一個命令按紐,計算結果將在窗體上輸出,代碼如下(直接拷貝)
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
a = 2
b = 4
c = 6
nn a, b, c
End Sub
Sub nn(a As Integer, b As Integer, c As Integer)
Dim i As Integer, j As Integer, k As Integer, s1 As Integer, s2 As Integer, s3 As Integer
s1 = 1
s2 = 1
s3 = 1
For i = 1 To a
s1 = s1 * i
Next i
For j = 1 To b
s2 = s2 * j
Next j
For k = 1 To c
s3 = s3 * k
Next k
Print "2!+4!+6!=" & s1 + s2 + s3
End Sub
上一篇dw表針生銹
下一篇access數據庫整型