Program to calculate Fibonacci Series of given number in vb.net in console application





What is Fibonacci Series?


Fibonacci sequence is a group of numbers that starts with one or zero, one after that, and goes on the basis of the rule that each number (which is called the Fibonacci number) is equal to the sum of the previous two numbers . If the Fibonacci sequence is denoted F (n), where n is the first word in the sequence, then the following equation is obtained for n = 0, where the first two words are defined as 0 and 1 by the convention :


f(0) = 0  1  1  2  3  5  8  .....

In some texts, the practice of using n = 1. is the practice. In that case, the first two words are defined by default as 1 and 1; So:

f(1) = 1  1  2  3  5  8........

The name of Fibonacci sequence is Leonardo Pisano (also known as Leonardo Pisano or Fibonacci), an Italian mathematician who lived from 1170-1250. Fibonacci used the arithmetic series to describe a problem based on a pair of fertile rabbits:

"How many pairs of rabbits will be produced in a year, starting with a single pair, if each pair holds a new pair in every month which becomes productive from the second month?" The result can be expressed numerically: 1, 1, 2, 3, 5, 8, 13, 21, 34 ...

Fibonacci numbers are interested in biologists and physicists because they are often seen in various natural objects and events. For example, branch pattern in trees and leaves, and distribution of seeds in raspberry is based on Fibonacci numbers.

A Sanskrit grammatist, Pingala is credited with the first mention of the sequence of numbers, sometime between the fifth century BC. And second or third century A. D. Since Fibonacci started the series of Western civilization, it has been a high profile from time to time. For example, in the Da Vinci Code, Fibonacci sequence is part of an important clue. Another application, Fibonacci poem, is a poem in which the progress of syllable numbers per line follows the Fibonacci pattern.

The Fibonacci sequence is related to the golden ratio, a ratio (approximately 1: 1.6), which is often in the natural world and applies to many areas of human effort. Both the Fibonacci sequence and the Golden Rule are used to design architecture, websites and user interfaces, among other things.






Example :
Code:



Module Module1

    Sub Main()
        Dim a, b, c, n, i As Integer
        Console.Write("Enter how many elements:-")
        n = Val(Console.ReadLine())
        a = 1
        b = 2
        Console.Write("1 2")
        i = 1
        While (i < n - 1)
            c = a + b
            Console.Write(" " & c)
            a = b
            b = c
            i = i + 1
        End While
        Console.ReadLine()

    End Sub

End Module


Output:


Comments