Hello
if i have an array consist of 5 integers from 1 to 5 like this
- int [] numbers={1,2,3,4,5};
And
Swap the second number (2) with the fourth number (4)
So the number 3 (which is in the middle will stay in the middle with index of 2).
I tried to swap between the first and last number in this manner:
- numbers[4]=numbers[0];
JohnPosted Jan 21, 2017, 12:11 AM