Given two integers, calculate and output their sum.
The input contains several test cases. The first line contains and integer t (t ≤ 100)
denoting the number of test cases. Then t
tests follow, each of them consisiting of two space separated integers x
and y
(−10^9 ≤ x, y ≤ 10^9).
For each test case output output the sum of the corresponding integers.
4
-100 100
2 3
0 110101
-1000000000 1
0
5
110101
-999999999
ICPC > Regionals > Europe > Central European Regional Contest > CERC 2008 PA번
import java.util.Scanner;
public class Code7891 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
int x=sc.nextInt();
int y=sc.nextInt();
System.out.println(x+y);
}
}
}
add
였기 때문에 int
범위를 안넘어가서 int
로 선언해서 더했다.