Baekjoon Algorithm | Problem 2741: Print N
Source
https://www.acmicpc.net/problem/2741
Problem
Solve Baekjoon Online Judge problem 2741, Print N.
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
1 2 3 4 5
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 = 1; i <= n; i++) {
System.out.println(i);
}
}
}
}