# Generate Fibonacci Series with an Algorithm in VB.NET

- 7852

The Fibonacci Series is a sequence of numbers first created by Leonardo Fibonacci (fi-bo-na-chee) in 1202 Sequence of numbers in which 1 appears twice as the first two numbers, and every subsequent number is the sum of two preceding numbers: 1, 1, 2, 3, 5, 8, 13....and so on. As it continues, the ratio between any number and its successor approaches the ratio of golden section (1:1.618). the most spectacular examples of the Fibonacci Series in nature is in the head of the sunflower. Scientists have measured the number of spirals in the sunflower head. They found, not only one set of short spirals going clockwise from the centre, but also another set of longer spirals going anti clockwise.

The Fibonacci Series is as follows 0 , 1 , 1 ,
2 , 3 , 5 , 8 , â€¦

The property of this series is that any given element in the series after the
third element is the sum of its first and second predecessor. For example,
consider 8. Its first and second predecessors are 5 and 3. Therefore, 5 + 3 = 8.
Consider 3. Its first and second predecessors are 2 and 1. 2 + 1 = 3. The
property of Fibonacci series holds.

The following is the algorithm to generate the Fibonacci series up to a given
number of elements.

**Algorithm** : Fibonacci_Series

**Input** : n, the number of elements in the series

**Output** : fibonacci series upto the nth element

**Method
**a = -1

b = 1

for(i=1 to n in steps of +1 do)

c = a + b

display 'c'

a = b

b = c

end_for

**Algorithm ends**

**Example **

Namespace
DBExample

Class
Program

Private
Shared
Sub
Main(ByVal
args As
String())

Dim
i As
Integer,
j As
Integer

i = -1

j = 1

Dim
n As
Integer

n = 20

Dim
fib As
Integer
= 1

While
fib <= n

fib = i + j

i = j

j = fib

Console.WriteLine(fib)

End
While

Console.Read()

End
Sub

End
Class

End
Namespace

**Summary
**
The above article show how to get Fibonacci Series, hope you will learn and use
this concept as you required.

### Categories

- ACTIVE DIRECTOTRY IN VB.NET
- ALGORITHMS AND VB.NET
- ARRAY IN VB.NET
- ASP.NET AJAX IN VB.NET
- ASP.NET USING VB.NET
- ASSEMBLIES IN VB.NET
- COM INTEROP IN VB.NET
- CRYPTOGRAPHY IN VB.NET
- CRYSTAL REPORTS IN VB.NET
- DATABASE & DBA
- DEPLOYMENT IN VB.NET
- DESIGN & ARCHITECTURE
- DIRECTX WITH VB.NET
- ENTERPRISE DEVELOPMENT
- FILE IN VB.NET
- GAMES IN VB.NET
- GDI+ IN VB.NET
- GENERAL
- LINQ WITH VB.NET
- MOBILE DEV IN VB.NET
- MULTITHREADING IN VB.NET
- NETWORKIN WITH VB.NET
- OFFICE AND VB.NET
- PRINTING IN VB.NET
- REMOTING IN VB.NET
- REPORTS IN VB.NET
- SECURITY IN VB.NET
- SILVERLIGHT USING VB.NET
- Speech in VB.NET
- STRING IN VB.NET
- TABLET PC
- VB.NET ADO.NET
- VB.NET ARTICLE
- VB.NET EXCEPTION HANDLING
- VB.NET FAQ
- VB.NET HOW DO I
- VB.NET LANGUAGE
- VB.NET TUTORIALS
- VB.NET WINDOWS SERVICES
- VBA
- VISUAL BASIC 10
- VISUAL BASIC LANGUAGE
- WCF WITH VB.NET
- WEB CONTROL IN VB.NET
- WEB DEV IN VB.NET
- WEB FORM WITH VB.NET
- WEB SERVICES IN VB.NET
- WINDOWS CONTROLS
- WINDOWS FORMS IN VB.NET
- WORKFLOW IN VB.NET
- WPF IN VB.NET
- XAML IN VB.NET
- XML IN VB.NET