vb中编程求fibonacci数列的前20项,并按每5项一行显示.要求用递归过程来实现fibon
发布网友
发布时间:2022-05-02 08:40
我来回答
共1个回答
热心网友
时间:2023-10-14 06:40
Private Sub Command1_Click()
Dim i As Integer
For i = 1 To 30
Print i; ": "; fib(i)
Next i
End Sub
Function fib(n As Integer) As Long
If n < 3 Then
fib = 1
Else
fib = fib(n - 1) + fib(n - 2)
End If
End Function