OJ在线编程常见输入输出练习场 第三题

A+B(3)

http://www.nowcoder.com/questionTerminal/4274505ccb754de4bc4dfec9acd201d5

需要注意的是java 代码不能像c++代码那样写, 这是会报错的

int a=10;
while(a){
a--;
}
import java.util.Scanner;
/**
 * 输入包括两个正整数a,b(1 <= a, b <= 10^9),输入数据包括多组
 */
public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
            int b = sc.nextInt();
        while(sc.hasNext()&&(a!=0)&&(b!=0)){

            System.out.println(a + b);
            a = sc.nextInt();
            b = sc.nextInt();
        }
    }
}
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务