Showing posts with label fibonacci numbers in visual basic net. Show all posts
Showing posts with label fibonacci numbers in visual basic net. Show all posts

Sunday, April 9, 2017

Fibonacci Number Sequence in Visual Basic NET

A simple program that I wrote using Visual Basic NET to ask the user to give a number and then our program will generate the corresponding fibonacci number sequence based on the given number by our user. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.




Sample Program Output


Program Listing

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim a As Integer = 0
        Dim i As Integer
        Dim b As Integer = 1
        Dim fib As Integer
        ListView1.Items.Add(1)
        i = Val(TextBox1.Text)

        ListView1.Items.Add(1)
        Do
            fib = a + b
            a = b
            b = fib
            ListView1.Items.Add(fib)
            i = i + 1
        Loop While fib < i

    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        End
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        Label2.Text = ""
        TextBox1.Focus()
        ListView1.Clear()
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class