Baekjoon Algorithm | Problem 2742: Print N Reversed
Source
https://www.acmicpc.net/problem/2742
Problem
Solve Baekjoon Online Judge problem 2742, Print N Reversed.
Input
Follow the input format and constraints given in the original problem statement.
Output
Print the answer required by the problem.
Sample Input 1
5
Sample Output 1
5 4 3 2 1
Solution
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
int n = Integer.parseInt(br.readLine());
for (int i = n; i > 0; i--) {
System.out.println(i);
}
}
}
}