본문 바로가기

JAVA-BAEKJOON/3단계 반복문

[백준/03-07] 11021 A+B - 7

NO.11021 

 

풀이코드

import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();

        for(int i=1; i<=T; i++){
            int A = sc.nextInt();
            int B = sc.nextInt();

            System.out.println("Case #" + i + ": " + (A + B));
        }

        sc.close();
    }
}

 

📌 Case #1 부터 시작이라 i 를 1부터로 하고 T보다 작거나 같을때까지 반복하라고 지정.