首页 > 学院 > 开发设计 > 正文

A+B

2019-11-08 02:41:05
字体:
来源:转载
供稿:网友

A+B PRoblem
描述

求两个整数A+B的和。

输入

输入包含多组数据。每组数据包含两个整数A(1 ≤ A ≤ 100)和B(1 ≤ B ≤ 100)。

输出

对于每组数据输出A+B的和。

样例输入
1 23 45 6
样例输出
3711

java 代码示例1:

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

java 代码示例2:

import java.util.Scanner;

public class Main {    public static void main(String[] args){        Scanner scan = new Scanner(System.in);        while(scan.hasNext()){            String s = scan.nextLine();            int a = Integer.parseInt(s.split(" ")[0]);            int b = Integer.parseInt(s.split(" ")[1]);            System.out.println(a+b);        }    }}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表