|
-
Nov 14th, 2002, 03:50 PM
#1
Thread Starter
New Member
Need help ASAP with a program on vb 6.0
The sequence of Fibonacci numbers begins with 1,1,2,3,5,8,13,21,34,..... and then continues with each sucessive number being the sum of the previous two.
I am to write a program that gets a number through a textbox and then prints the first Fibonacci numbers in a picture box.
Example user enters 7 then in pictue box should show 1,1,2,3,5,8,13. The first 7 fibonacci numbers.
Here is what I have and it doesn't work. I just need it basic.
Dim num1 As Integer
Dim num2 As Integer
Dim temp As Integer
Dim n As Integer
Dim i As Single
Private Sub txtnumber_Change()
n = txtnumber.Text
num1 = 1
num2 = 1
temp = 0
Picture1.Print num1; num2;
For i = 1 To n
temp = num1 + num2
i = i + 1
Picture1.Print temp;
num1 = num2
num2 = temp
Next i
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|