vb求斐波那契(Fibonaccii)数列前20项的和
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/10 07:37:40
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 Su
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 Su