输入:
输入包括两个正整数a,b(1 <= a, b <= 1000),输入数据包括多组。
输出:
输出a+b的结果
示例:
输入:
1 5
10 20
输出:
6
30
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNextLine()){
String[] s = sc.nextLine().split(" ");
int sum = 0;
for(int i = 0; i < s.length; i ++){
sum = sum + Integer.parseInt(s[i]);
}
System.out.println(sum);
}
}
}
输入:
输入第一行包括一个数据组数t(1 <= t <= 100)
接下来每行包括两个正整数a,b(1 <= a, b <= 1000)
输出:
输出a+b的结果
示例:
输入:
2
1 5
10 20
输出:
6
30
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
while(n > 0){
String[] s = br.readLine().split(" ");
int a = Integer.parseInt(s[0]);
int b = Integer.parseInt(s[1]);
System.out.println(a + b);
n --;
}
}
}