输入样例:
1 1
2 3
-100 100
-100 -100
10 0
输出样例:
2
5
0
-200
10
sc.hasNext()用于判断接下来还有没有输入,没有则结束循环
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext())
{
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(a + b);
}
}
}