0 a+b

import java.util.*;
public class Main
{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
while (sc.hasNextInt()){
int a=sc.nextInt();
int b=sc.nextInt();
System.out.println(a+b);
}
}
}

 

收获:while (sc.hasNextInt())

可以输入多行数据,题目说的不是很清楚。

posted @ 2017-03-16 10:54  code666  阅读(159)  评论(0编辑  收藏  举报