[백준(Baekjoon)][자바(java)] (10951) A+B - 4 / while문

728x90

 

문제 :

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

 

입력 :

입력은 여러 개의 테스트 케이스로 이루어져 있다.

각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 AB가 주어진다. (0 < A, B < 10)

 

출력 :

각 테스트 케이스마다 A+B를 출력한다.

 

 

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		while( sc.hasNext() ) 
			System.out.println( sc.nextInt() + sc.nextInt() );

		sc.close();
	}
}

 

 

반응형