计算a+b
数据范围:数据组数满足 , 数据大小满足 输入包括两个正整数a,b(1 <= a, b <= 10^9),输入数据有多组, 如果输入为0 0则结束输入
输出a+b的结果
1 5 10 20 0 0
6 30
/*** 输入例子1: 1 5 10 20 0 0 输出例子1: 6 30 **/ import java.util.Scanner; public class Main_03 { public static void main(String args[]){ Scanner sc = new Scanner(System.in); boolean returnGrop = true; while (returnGrop){ int a = sc.nextInt(); int b = sc.nextInt(); if(a + b == 0){ returnGrop = false; continue; } System.out.println(a+b); } } }
while(true) { const line = readline(); if(line !== '0 0') { const arr = line.split(' '); console.log(Number(arr[0])+Number(arr[1])); } else { break; } }