Array of even numbers Learn programming Visual Basic (VB.net)

Lesson:

Arrays, Structures and Strings


Exercise:

Array of even numbers


Objetive:

Write a Visual Basic (VB.net) program to ask the user for 10 integer numbers and display the even ones.


Code:

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

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

        For i As Integer = 0 To 10 - 1
            If numbers(i) Mod 2 = 0 Then Console.Write("{0} ", numbers(i))
        Next
    End Sub
End Class

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