Odd numbers descending Learn programming Visual Basic (VB.net)

Lesson:

Flow Control


Exercise:

Odd numbers descending


Objetive:

Create a Visual Basic (VB.net) program to display the odd numbers from 15 to 7 (downwards) on the screen using "while".


Code:

Imports System
Public Class exercise24
    Public Shared Sub Main()
        Dim n As Integer = 15

        While n >= 7
            Console.WriteLine(n)
            n -= 2
        End While
    End Sub
End Class

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