본문 바로가기
Algorithm/Beakjoon

[Java] baekjoon 10952 : A+B - 5 / while문

by Amy97 2021. 8. 1.
728x90

문제 


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

 

10952번: A+B - 5

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

www.acmicpc.net

구현 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        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);
        }
 
    }
}
cs

결과 


728x90

댓글