본문 바로가기
Baekjoon/브론즈 5

[백준][JAVA/자바] 10951번: A+B - 4

by 감자감자곰 2022. 12. 2.

<단계>

브론즈 5


<문제>

 

10951번: A+B - 4

두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.

www.acmicpc.net


<코드>

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);

		while (s.hasNextInt()) {
			int a = s.nextInt();
			int b = s.nextInt();

			System.out.println(a + b);
		}
	}

}

<개념>

(1) hasNextInt()

댓글