[백준] 10952 : A+B - 5 - Java

길 잃은 까마귀·2022년 9월 13일
0

https://www.acmicpc.net/problem/10952


  • 문제

  • 풀이
    while문으로 무한 반복문을 만들고 if문으로 0 0 을 입력받으면 탈출하는 문제이다.

  • 코드
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {

		Scanner in = new Scanner(System.in);

		while (true) {

			int A = in.nextInt();
			int B = in.nextInt();

			if (A == 0 && B == 0) {
				in.close();
				break;
			}
			System.out.println(A + B);
		}
	}
}
profile
코딩 고수가 될 사람

0개의 댓글