Jump to content

While loop with Fibonacci numbers!


G+_Ash Chetri
 Share

Recommended Posts

While loop with Fibonacci numbers!

 

Public Class Form1

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim a As Integer = 0

    Dim b As Integer = 1

    Dim fib As Integer = 0

 

    Do

      fib = a + b

      a = b

      b = fib

      Label1.Text = Label1.Text + fib.ToString & ControlChars.NewLine

    Loop While fib < 55

  End Sub

End Class

Link to comment
Share on other sites

 Share

×
×
  • Create New...