首页 > 其他 > 详细

题目1000:计算a+b

时间:2014-10-31 18:51:55      阅读:281      评论:0      收藏:0      [点我收藏+]
题目描述:

求整数a,b的和。

输入:

测试案例有多行,每行为a,b的值。

输出:

输出多行,对应a+b的结果。

样例输入:
1 2
4 5
6 9
样例输出:
3
9
15

java Code

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();
            int c = a + b;
            System.out.println(c);
        }
    }
}
 
/**************************************************************
    Problem: 1000
    User: Mokaffe
    Language: Java
    Result: Accepted
    Time:80 ms
    Memory:15468 kb
****************************************************************/

C Code

#include <stdio.h>
int main() {
    int a,b;
    while (scanf("%d %d",&a, &b) != EOF) {
        printf("%d\n",a+b);
    }
    return 0;
}
/**************************************************************
    Problem: 1000
    User: Mokaffe
    Language: C
    Result: Accepted
    Time:0 ms
    Memory:912 kb
****************************************************************/

 

题目1000:计算a+b

原文:http://www.cnblogs.com/Mokaffe/p/4065650.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!