#C14577. Filter Even Numbers

    ID: 44241 Type: Default 1000ms 256MiB

Filter Even Numbers

Filter Even Numbers

You are given a list of integers, and your task is to filter out all the odd numbers and output only the even numbers in the same order as given. If there are no even numbers in the list, you should output an empty line.

Input Format: The first line contains an integer \(n\) representing the number of elements in the list. The second line contains \(n\) space-separated integers.

Output Format: Print the even numbers separated by a space in a single line. If there are no even numbers, print an empty line.

Examples:

  • For input: 10
    1 2 3 4 5 6 7 8 9 10
    , the output should be: 2 4 6 8 10.
  • For input: 5
    1 3 5 7 9
    , the output should be an empty line.

inputFormat

The input is given via standard input (stdin) and contains two lines:

  1. The first line contains an integer \(n\) — the number of integers in the list.
  2. The second line contains \(n\) space-separated integers.

outputFormat

Output to standard output (stdout) in a single line all the even integers from the input list, separated by a single space. If no even integers exist, output an empty line.

## sample
10
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10