vb求斐波那契(Fibonaccii)数列前20项的和

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 11:40:26

vb求斐波那契(Fibonaccii)数列前20项的和
vb求斐波那契(Fibonaccii)数列前20项的和

vb求斐波那契(Fibonaccii)数列前20项的和
Private Function bq(ByVal s As Long) As Long
Select Case s
Case 1
bq = 1
Case 2
bq = 1
Case Is >= 3
bq = bq(s - 1) + bq(s - 2)
End Select
End Function
Private Sub Command1_Click()
summ = 0
For i = 1 To 20
summ = summ + bq(i)
Next i
Print summ
End Sub