While + Counter Learn programming Visual Basic (VB.net)

Lesson:

Flow Control


Exercise:

While + Counter 55


Objetive:

Create a Visual Basic (VB.net) program to display the numbers 1 to 10 on screen, using "while".


Code:

Imports System
Public Class Exercise22
    Public Shared Sub Main()
        Dim n As Integer = 1

        While n <= 10
            Console.Write("{0} ", n)
            n += 1
        End While
    End Sub
End Class