如何用vb编程求打印fibonacci 数列的前30项
答案:1 悬赏:40 手机版
解决时间 2021-06-09 21:59
- 提问者网友:寂寞梧桐
- 2021-06-09 02:04
如何用vb编程求打印fibonacci 数列的前30项
最佳答案
- 五星知识达人网友:鱼忧
- 2021-06-09 02:19
Private Sub Command1_Click()
Dim a(30) As Long
a(1) = 1: a(2) = 1
For i = 3 To 30
a(i) = a(i - 1) + a(i - 2)
Next i
n = Len(Str(a(30))) + 2
b = 1
For i = 1 To 30
c = Len(Str(a(i))) + 1
Print Tab(b * n - c); a(i);
b = b + 1
If i Mod 5 = 0 Then
Print
b = 1
End If
Next i
End Sub
Dim a(30) As Long
a(1) = 1: a(2) = 1
For i = 3 To 30
a(i) = a(i - 1) + a(i - 2)
Next i
n = Len(Str(a(30))) + 2
b = 1
For i = 1 To 30
c = Len(Str(a(i))) + 1
Print Tab(b * n - c); a(i);
b = b + 1
If i Mod 5 = 0 Then
b = 1
End If
Next i
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯