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