4.03 - Array, even numbers

Objetive

Write a C# program to ask the user for 10 integer numbers and display the even ones.

Solution

using System;
public class ArrayEvenNumbers
{
public static void Main()
{   
int[] numbers = new int[10];

for (int i = 0; i < 10;i++)
{
Console.Write("Numero {0}= ",i+1);
numbers[i] = Convert.ToInt32( Console.ReadLine());
}

for (int i = 0;i < 10;i++)
if (numbers[i]%2==0)
Console.Write("{0} ",numbers[i]);
}
}

Popular Posts