Answer:
public class MyArray_DE
{
public static void main(String[] args) {
int[] numbers = {28, 7, 92, 0, 100, 77};
int total = 0;
for (int i=0; i<numbers.length; i++){
if(numbers[i] % 2 == 0)
total += numbers[i];
}
System.out.println("The sum of even numbers is " + total);
System.out.println("The numbers in reverse is ");
for (int i=numbers.length-1; i>=0; i--){
System.out.print(numbers[i] + " ");
}
}
}
Explanation:
Since you did not provide the previous code, so I initialized an array named numbers
Initialize the total as 0
Create a for loop that iterates through the numbers
Inside the loop, if the number % 2 is equal to 0 (That means it is an even number), add the number to total (cumulative sum)
When the loop is done, print the total
Create another for loop that iterates through the numbers array and print the numbers in reverse order. Note that to print the numbers in reverse order, start the i from the last index of the array and decrease it until it reaches 0.