본문 바로가기

study/baekJun

[백준/java/자바/A+B/for문]백준 10950 A+B

출처:https://www.acmicpc.net/problem/10950

몇 번 반복할 것인지 T를 입력 받은 후

T번 만큼

A+B를 입력받고 결과를 출력하는 반복문을 만들자

import java.util.Scanner;
import java.io.*;
public class qn10950{
   public static void main(String[] args){
      
      Scanner sc = new Scanner(System.in);
      
      int A,B;
      int T;
      
      T = sc.nextInt();
      for(int i=0;i<T;i++){
         A = sc.nextInt();
         B = sc.nextInt();  
          
          System.out.println(A+B);
      }
   }
}