Exercise
Odd numbers descending
Objetive
Write a Visual Basic (VB.Net) program to display the odd numbers from 15 to 7 (downwards) on the screen using "while".
Code
' Import the System namespace to use Console class
Imports System
Public Class Program
' Main subroutine, entry point of the program
Public Shared Sub Main()
' Initialize the starting number as 15
Dim number As Integer = 15
' Start a while loop to display odd numbers from 15 to 7
While number >= 7
' Display the current odd number
Console.WriteLine(number)
' Decrease the number by 2 to get the next odd number in descending order
number -= 2
End While
End Sub
End Class