Need to fix this piece of code for use with n Number of some finite array. swapping with next one like this code outputs "456123" next three are swap with other next three elements.
<pre> int[] array = {1, 2, 3, 4, 5, 6}; int c; for(int i=0;i<=2;i++) { c = array[i]; array[i] = array[i+3]; array[i+3] = c; } for(int i=0;i<=5;i++) System.out.println(array[i]);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)