742
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Dim a As Integer
Dim b As Integer
Private Sub Command1_Click()
a = 1
b = 4
MsgBox stack(b)
End Sub
Private Function stack(stackitem As Integer) As Long
If a = 1 Then
stack = 1
ElseIf stackitem = b Then
stack = b
Exit Function
Else
stack = stackitem
End If
a = a + 1
If a <= b Then stack = stack * stack(a)
End Function
Option Explicit
Private Sub Command1_Click()
Dim n%, i%, R&
n = InputBox("")
R = Rsl(n)
MsgBox R
End Sub
Private Function Rsl(Item As Integer) As Double
If Item = 0 Then Rsl = 1 Else Rsl = Item * Rsl(Item - 1)
End Function
Option Explicit
Dim a As Integer
Dim b As Integer
Private Sub Command1_Click()
a = 3
b = 4
MsgBox stack(a, b)
End Sub
Private Function stack(startitem As Integer, enditem As Integer) As Long
If a = 0 Or a = 1 Then
stack = 1
ElseIf startitem = b Then
stack = b
Exit Function
Else
stack = startitem
End If
a = a + 1
If a <= b Then stack = stack * stack(a, b)
End Function