I was given 2 arrays:
array1 = {6, 13, 18, 1, 9, 7, 16, 11, 2}
array2 = {4, 10, 5, 12, 3, 8, 14}
I have to move the values in the two arrays so that all even values are in array 1 and all odd values are in array 2. However I can only use the 2 given arrays and cant use any additional data structures(part of the assignment).
I know I have to use a for loop and inside it i need an if statement but for some reason im forgetting how I should write the if statement having not coded in a minute.
for(int i = 0; i < array1.length; i++) {
int value = i;
}
This is what I have so far