Scanner
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i=1;i<=n;i++)
System.out.println(i);
}
}
BufferedReader,BufferedWriter
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
for(int i=1;i<=n;i++)
bw.write(i+"\n");
bw.flush();
}
}
'💡 Algorithm > 백준' 카테고리의 다른 글
[JAVA] 백준 #2675 - 문자열 반복 (0) | 2020.08.21 |
---|---|
[JAVA ] 백준 #1157- 단어 공부 (0) | 2020.08.20 |
[JAVA ] 백준 #2839- 설탕 배달 (0) | 2020.08.20 |
[JAVA ] 백준 #15552 - 빠른 A+B (0) | 2020.06.24 |
[JAVA] 백준 #2884 - 알람 시계 (0) | 2020.06.16 |
[C] 백준 #10430 - 나머지 (0) | 2020.06.15 |