19 Program to Print 1-20 Fibonacci Series on Click Button in VB.NET

Code:

Public Class Form1

    Dim f1, f2, f3, num As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       
        f1 = 0
        f2 = 1
        f3 = 0

        While f3 < 20
            f1 = f2
            f2 = f3
            MsgBox(f3)
            f3 = f1 + f2
        End While
    End Sub


End Class



Output:  



Previous
Next Post »