码迷,mamicode.com
首页 > 其他好文 > 详细

1001 A+B Problem

时间:2018-07-26 13:15:18      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:one   整数   lin   imp   util   string   ext   ons   alc   

Calculate a+b

计算a+b

Input

输入

The input will consist of a series of integers a and b, separated by a space, one pair of integers pet line

输入由一对整数a和b组成,由一个空格分开,每行有一对整数

Output

输出

For each pair of input integers a and b you should output the sum of  a and b in one line, and with one line of output for each line in input

对于每一对整数a和b,你应该在一行中输出a和b的和,在输入的每一行中输出一行

Sample Input

输入示例

1 5

Sample Output

输出示例

6

Hint

提示

Use + operator

用+运算符

Sample Program Here

程序示例

import java.util.Scanner;

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

 

1001 A+B Problem

标签:one   整数   lin   imp   util   string   ext   ons   alc   

原文地址:https://www.cnblogs.com/heibaimao123/p/9370831.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!