首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >HDOJ 1091 A+B for Input-Output Practice (III)

HDOJ 1091 A+B for Input-Output Practice (III)

作者头像
谙忆
发布2021-01-19 15:08:01
发布2021-01-19 15:08:01
3780
举报
文章被收录于专栏:程序编程之旅程序编程之旅

Problem Description Your task is to Calculate a + b.

Input Input contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be processed.

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.

Sample Input 1 5 10 20 0 0

Sample Output 6 30

代码语言:javascript
复制
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc =new Scanner(System.in);
    while(sc.hasNext()){

    int a=sc.nextInt();
    int b=sc.nextInt();
    if(a==0&&b==0)
      return ;  
    System.out.println(a+b);
    }
  }
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2015/10/22 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档