Module: QUEUE PRACTICE


Problem

1/5

Start of queue

Theory Click to read/hide

Queue — abstract data type with access to  elements on a first-come — first came out» (FIFO, First In — First Out).

For ease of remembering, you can remember the usual queue in the store.

queue<int> a; – creating an empty queue with no elements 

a.push(5); – add the value 5 to the end of the queue
 
a.pop(); – remove the first element in the queue
 
int b = a.front();  – return the first element in the queue to the variable  (without deletion)
 
a.empty() – return true if the queue is empty,  and false otherwise.

Problem

Given a sequence of natural numbers with the number N (1<=N<= 100).
Enter data into the queue and output only even numbers.

Example
Input:
5
1 2 3 4 5

Output:
24