Pairwise permutation
Problem
Given a number
N
(
\(2<=N<=20\),
N
-even) - the number of array elements. Write a program that swaps pairs of elements of a given array. That is, the first with the second, the third with the fourth, etc.
Input
The first line contains the number
N
- the number of array elements. The second line contains the values of the array elements.
Imprint
You need to display the resulting array.
Example
# |
Input |
Output |
1 |
4
1 2 3 4
| 2 1 4 3 |
Запрещенные операторы: insert
; pop
; del
; remove
; index