hyc991028   1년 전

import java.util.Scanner;
import java.util.ArrayList;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.<i>in</i>);
        ArrayList<Integer> A = new ArrayList<>();
        ArrayList<Integer> B = new ArrayList<>();
        ArrayList<Integer> result = new ArrayList<>();
        int cnt =0;

        while(true){
            A.add(sc.nextInt());
            B.add(sc.nextInt());

            result.add(A.get(cnt)+B.get(cnt));

            if(A.get(cnt)==5 && B.get(cnt)==2){
                break;
            }
            cnt += 1;
        }
        for(int sum : result){
            System.<i>out</i>.println(sum);
        }
    }
}

elic121   1년 전

주어진 예제와 다른 입력이 주어질 수 있습니다. 끝나는 조건을 다시 설정해보세요.

댓글을 작성하려면 로그인해야 합니다.