C# Codes Fibonacci Series in VB .Net

Fibonacci Series in VB .Net

61

 Fibonacci series, next number is the sum of previous two numbers for example 0, 1, 1, 2, 3, 5, 8, 13, 21, etc. The first two numbers of the Fibonacci series are 0 and 1.

Let’s see the Fibonacci series program in VB .net Console Mode.¬†

 

Sub main()
Dim x, y, n, i, sum As Integer
Console.WriteLine(“Enter the value”)
n = Console.ReadLine()
x = 0
y = 1
Console.WriteLine(x)
Console.WriteLine(y)

For i = 3 To n
sum = x + y
Console.WriteLine(sum)
x = y
y = sum

Next i

Console.ReadKey()
End Sub

 

 

NO COMMENTS