The array x={2, 3, 4, 4, -5, 4, 6, 2} the resulting array is to be x={2, 3, 5, 5, -5, 5, 6, 2}, and the number of changes reported with a message like "The number of changes is 3" printed on screen.
public class anArray {
public static void main(String[]args) {
int [] x = {2, 3, 4, 4, -5, 4, 6, 2};
for (int i=0; i<x.length; i++) {
System.out.println(x[i]);
} //currently only I am able to print whole array element
}
}
1 Answer