백준 10952번 A+B java

Dev_HG·2020년 12월 14일
post-thumbnail

풀이
a,b를 0으로 입력하면 반복문을 벗어나면 된다.

import java.io.IOException;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) throws IOException {
		
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(a == 0 && b == 0)break;
			System.out.println(a + b);
		}
	
	}
}
profile
꾸준함

0개의 댓글