VB:有一个数列,前两个数是1,1,……要求输出此数列的前30个数.Private Sub Command1_Click()Dim a(30)If Option1.Value = True Thena(1) = 1a(2) = 1For i = 3 To 30a(i) = Val(a(i - 1)) + Val(a(i - 2))NextText1.Text = a(30)End Ifend sub这
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/14 15:52:27
VB:有一个数列,前两个数是1,1,……要求输出此数列的前30个数.Private Sub Command1_Click()Dim a(30)If Option1.Value = True Thena(1) = 1a(2) = 1For i = 3 To 30a(i) = Val(a(i - 1)) + Val(a(i - 2))NextText1.Text = a(30)End Ifend sub这
VB:有一个数列,前两个数是1,1,……要求输出此数列的前30个数.
Private Sub Command1_Click()
Dim a(30)
If Option1.Value = True Then
a(1) = 1
a(2) = 1
For i = 3 To 30
a(i) = Val(a(i - 1)) + Val(a(i - 2))
Next
Text1.Text = a(30)
End If
end sub
这是我写的,但运行之后不对,请大侠指出错误~
VB:有一个数列,前两个数是1,1,……要求输出此数列的前30个数.Private Sub Command1_Click()Dim a(30)If Option1.Value = True Thena(1) = 1a(2) = 1For i = 3 To 30a(i) = Val(a(i - 1)) + Val(a(i - 2))NextText1.Text = a(30)End Ifend sub这
Private Sub Command1_Click()
Dim a(30) as Integer
If Option1.Value = True Then
a(1) = 1
a(2) = 1
For i = 3 To 30
a(i) =a(i - 1) + a(i - 2)
Next
Text1.Text =str(a(30))
End If
end sub