Dim num() Private Sub Form_Load() Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, mycount ReDim num(mycount) num(0) = 0 num(1) = 1 For i = 2 To mycount num(i) = num(i - 1) + num(i - 2) Next Print #2, num(mycount) Close #2 Close #1 End Sub
Dim a() Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, s ReDim a(s) a(0) = 0 a(1) = 1 For i = 2 To s a(i) = a(i - 2) + a(i - 1) Next Print #2, a(s) Close Close End End Sub
Dim num()
回覆刪除Private Sub Form_Load()
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, mycount
ReDim num(mycount)
num(0) = 0
num(1) = 1
For i = 2 To mycount
num(i) = num(i - 1) + num(i - 2)
Next
Print #2, num(mycount)
Close #2
Close #1
End Sub
Dim a()
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, s
ReDim a(s)
a(0) = 0
a(1) = 1
For i = 2 To s
a(i) = a(i - 2) + a(i - 1)
Next
Print #2, a(s)
Close
Close
End
End Sub