백준 10952번 A+B

Dev_HG·2020년 12월 14일
0

풀이
while 반복문을 중점으로 생각을 해봤다.
입력 값이 없다면 while문을 벗어날 수 있게 설정하면 되는거 같다

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(sc.hasNext()){
			
			int a = sc.nextInt();
			int b = sc.nextInt();
			System.out.println(a + b);
		}
	
	}
}
profile
꾸준함

0개의 댓글

Powered by GraphCDN, the GraphQL CDN