6
1
2
3
4
5
6
6
5
4
3
2
1
Process finished with exit code 0
package com.javarush.task.pro.task05.task0505;
import java.util.Scanner;
/*
Reverse
*/
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] num = new int[n];
if (n > 0) {
for (int i = 0; i < n; i++) {
num[i] = sc.nextInt();
}
}
if (n % 2 != 0) {
for (int i = 0; i < num.length; i++) {
System.out.println(num[i]);
}
} else {
for (int i = 0; i < num.length; i++ ) {
System.out.println(num.length - i);
}
}
}
}