Description

Contest

Stack & Queue

Letter

C

About

ODD AND EVEN

C. Dividing Even and Odd
---
First enter integer number N in the range of [10...100] then reads N integer numbers of the range [1..101]. The numbers should be stored in STACK. When displaying the elements of the stack, divide the numbers into even and odd, and first output all even numbers, and then all odd numbers. Even values are displayed in the same order as they were entered, and odd values are displayed in the reverse order of their entry.

Sample input:
10 
42 468 335 501 170 725 479 359 963 465

Sample output:
42 468 170 465 963 359 479 725 501 335

Problems Submit Question