#C12465. Filter Positive Even Numbers
Filter Positive Even Numbers
Filter Positive Even Numbers
Given a list of integers, your task is to filter out and output all the numbers that are both positive and even.
The criteria are as follows:
- A number is considered positive if it is greater than 0.
- A number is even if it is divisible by 2 (i.e., $n \% 2 = 0$).
You must maintain the original order in which the numbers appear in the input. If no number meets the criteria, output an empty line.
inputFormat
The input consists of two lines:
- The first line contains a single integer n indicating the number of integers in the list.
- The second line contains n space-separated integers.
Note: Here, \( n \) is non-negative.
outputFormat
Output a single line with the positive even numbers separated by a single space, preserving their original order. If there are no valid numbers, output an empty line.
## sample8
-10 -7 0 2 3 8 11 14
2 8 14