inblog logo
|
muaga's Hub
    BACKJOON-Java

    [백준/Java] 10950번 A+B - 3 (반복문)

    [백준/Java] 10950번 A+B - 3 (반복문)
    muaga's avatar
    muaga
    Jun 06, 2024
    [백준/Java] 10950번 A+B - 3 (반복문)
    Contents
    문제입력출력답
     

    문제


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

    입력


    첫째 줄에 테스트 케이스의 개수 T가 주어진다.
    각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 < A, B < 10)

    출력


    각 테스트 케이스마다 A+B를 출력한다.
    입력
    출력
    5 → T 1 1 2 3 3 4 9 8 5 2
    2 5 7 17 7
     

    답


    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 n = 0; n < t; n++) { int a = sc.nextInt(); int b = sc.nextInt(); System.out.println(a + b); } sc.close(); } }
    Share article
    Contents
    문제입력출력답

    muaga's Hub

    RSS·Powered by Inblog