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

Lesson:

Flow Control


Exercise:

While + Counter


Objetive:

Create a Visual Basic (VB.net) program to display the numbers 1 to 10 on the 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

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.