题目描述
Calculate a + b. a and b are integers.
输入
The input may contain several test cases.
In each test case, there are two integers, a and b, separated by a space.
Input is terminated by two consecutively inputted ZEROs, separated by a space .
输出
For each test case, print out the sum of a and b.
样例输入
1 2
10 20
324 111
0 0
样例输出
3
30
435
代码实现:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s1=new Scanner(System.in); while (s1.hasNextInt()) { int a=s1.nextInt(); int b=s1.nextInt(); if (b==0&&a==0) { break ; } System.out.println(a+b); } s1.close(); } }