Tip) Scanner의 hasNext()를 통해 EOF를 판단.
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(a + b);
}
}
}
'PS > BOJ' 카테고리의 다른 글
| 11726 / 11727 (0) | 2022.04.23 |
|---|---|
| 1463 (0) | 2022.04.23 |
| 2439/2442/2445/2522/10991/10992 (0) | 2022.04.23 |
| 11721 (0) | 2022.04.23 |
| 백준 공부 순서 (0) | 2022.04.23 |