for the reverse order, method is:
for (int i = 0; i < data.length; i++) {
System.out.println(data[i]);
}
This evaluates and runs flawlessly in intelliJ IDEA, but doesn't evaluate in the mobile app version of CodeGym. They specifically want you to set up your for loop to start at the highest index and decrement your way down. Just a heads up
package en.codegym.task.pro.task05.task0505;
import java.util.Scanner;
/*
Reverse
*/
public class Solution {
public static void main(String[] args) {
//write your code here
Scanner input = new Scanner(System.in);
// Take an integer N from the keyboard and see if it is greater than zero
System.out.println("Enter an integer");
int N = input.nextInt();
if (N > 0) {
int[] array = new int[N];
System.out.println("Enter " + N + " integers");
for (int i = 0; i < N; i++) {
array[i] = input.nextInt();
}
// if N is odd, display them in the order in which they were entered
if (N % 2 != 0) {
System.out.println("You've Entered: ");
for (int i = 0; i < N; i++) {
System.out.println(array[i]);
}
}
// if N is even, display them in reverse order
else {
System.out.println("In reverse order, you've entered: ");
for (int i = 0; i < N; i++) {
System.out.println(array[N - 1 - i]);
}
}
}
else {
System.out.println("You've entered a number that is not greater than zero, exiting the program.");
}
}
}