# help in code plz

Discussion in 'Programmer's Corner' started by sangwooyasso, Dec 28, 2009.

1. ### sangwooyasso Thread Starter New Member

Dec 28, 2009
2
0
can any one tell me any information about fibunacci seies?

Last edited: Dec 28, 2009
2. ### beenthere Retired Moderator

Apr 20, 2004
15,808
295
I am sure Google can. Have you tried searching the internet? Have you looked in a math textbook?

3. ### Tahmid Active Member

Jul 2, 2008
344
28
Hi,
Look here:
http://en.wikipedia.org/wiki/Fibonacci_number

Lets take a sequence starting from 1 and upto about 20 terms.
The first number is 1, the next will be (1 + 0) = 1, the next will be 1 + 1 = 2, 1+2=3, 2+3 = 5, where the nth term is equal to the sum of the (n-1)th term and the (n-2)th term.

4. ### Tahmid Active Member

Jul 2, 2008
344
28
Hi again,
Here's a sample code in VB6:

Code ( (Unknown Language)):
1.
2. Dim firstno As Integer
3. Dim secondno As Integer
4. Dim lastno As Integer
5. Dim loopno As Integer
6.
7. Private Sub Command1_Click()
8.     On Error GoTo ErrH
9.     Me.Cls              'Clear form before printing anything
10.     firstno = 1         'This is the number with which the series starts, dont
11.                            'change
12.     secondno = 1     'This is the number following, dont change
13.     lastno = 22        'This is the last number to which to calculate the
14.                            '     series. This is going to be greater than the last no.
15.                            '     Change as desired
16.     Print 0
17.     Print firstno
18.     Print secondno
19.     Do
20.         loopno = secondno
21.         secondno = firstno + secondno
22.         If secondno < lastno Then
23.             firstno = loopno
24.             Print secondno
25.         End If
26.     Loop Until secondno > lastno
27. ErrH: 'In case there is some error in the loop
28. End Sub
29.
Hope this clears things up.

File size:
3 KB
Views:
8
5. ### sangwooyasso Thread Starter New Member

Dec 28, 2009
2
0
hi
thank you tahmid you make it easy for me to understand this sequence