백준 단계별

[Java] 백준 10950: A+B-3

pullwall 2023. 1. 4. 14:20
728x90
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int test = sc.nextInt();
		
		for(int i=0;i<test;i++) {
			int A = sc.nextInt();
			int B = sc.nextInt();
			System.out.println(A+B);
		}
	}
}

test횟수를 for문 밖에서 입력받고

이후엔 test횟수만큼 A와 B를 입력받아 A+B를 출력할 수 있도록 한다.

728x90