Reverse array Learn programming Visual Basic (VB.net)

Lesson:

Arrays, Structures and Strings


Exercise:

Reverse array 54


Objetive:

Create a Visual Basic (VB.net) program to ask the user for 5 numbers, store them in an array and show them in reverse order.


Code:

Imports System
Public Class exercise72
    Public Shared Sub Main()
        Dim numbers As Integer() = New Integer(4) {}

        For i As Integer = 0 To 5 - 1
            Console.Write("Number {0} =  ", i + 1)
            numbers(i) = Convert.ToInt32(Console.ReadLine())
        Next

        Console.WriteLine()

        For i As Integer = 4 To 0
            Console.Write("{0} ", numbers(i))
        Next
    End Sub
End Class