I don't know what I'm doing wrong. In IntelliJ I console it works the way it should. I first enter a number n and if this number is greater than zero I enter n more numbers. If n is even (n % 2 == 0) I display them in reverse order on a new line and if n is odd I display them on a new line w/o changing the order.
package en.codegym.task.pro.task05.task0505;
import java.sql.SQLOutput;
import java.util.Scanner;
/*
Reverse
*/
public class Solution {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int[] numbers;
System.out.println("Enter a number");
int n = keyboard.nextInt();
if(n > 0) {
numbers = new int[n];
for (int i = 0; i < n; i++) {
System.out.println("Enter another number");
numbers[i] = keyboard.nextInt();
}
if(n % 2 == 0) {
for (int i = n - 1; i >= 0; i--) {
System.out.println(numbers[i]);
}
} else {
for (int i = 0; i < n; i++) {
System.out.println(numbers[i]);
}
}
}
}
}