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

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/28 04:07:28
vb求斐波那契(Fibonaccii)数列前20项的和
x)+Kzٴ 6/zٴ҉te&%&'gflꆧӟv\zlԩ_`gCEe% ny%y INa9 >y0XCpjNjrsbqB1X43 lLVQb;[cb]CMmH,횗΅I y)9Kss69nE (+ +S`3!R+J2a䕀U Td_\g

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