设计VB程序,计算数列2⼀1,3⼀2,5⼀3,8⼀5,13⼀8,21⼀13……的前20项之和

设计VB程序,计算数列2/1,3/2,5/3,8/5,13/8,21/13……的前20项之和
2024-11-27 12:55:30
推荐回答(1个)
回答1:

Private Sub Command1_Click()

  a = 2

  b = 1

  s = 0

  For i = 1 To 20

    s = s + a / b

    c = a + b

    b = a

    a = c

  Next i

  Print s

End Sub