The LIFO principle in action

Report a typo

Write a program that reads the input elements and outputs them in the reverse order.


The first string contains the number of elements. Each line followed the first one contains an element.

Sample Input 1:

3
1
2
3

Sample Output 1:

3
2
1
Write a program in Java 17
class Main {
public static void main(String[] args) {
// put your code here
}
}
___

Create a free account to access the full topic