Even Array Traversal Modified
Description
You are given an array of N integers. Print all the pairs of indexes, and values stored at that positions, in the array, where the even numbered positions hold even values.
Note : Consider that the indexing in the array starts from 0. The values must be printed in the order in which they arrive in the array.
Input
The first line of the input contains N, the size of the array. The next line contains N space separated integers, denoting the values in the array.
Constraints
1 <= N <= 100
1 <= A[i] <= 100
Output
Print all the pairs of indexes and their values, where the indexes and the values held by them, both are even, on a new line.
Hint
The even numbered indexes are 0, 2 and 4. The values stored by those indexes are 2,4 and 5. Since only 2 and 4 are even, therefore, the answer is
0 2
2 4
Comments
Post a Comment