hiho第一周A+B各种语言版本(内容来自hiho)

时间限制: 1000ms
单点时限: 1000ms
内存限制: 256MB

描述

求两个整数A+B的和

输入

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

输出

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

样例输入
1 2
3 4
样例输出
3

7

语言 样例程序
C
#include <stdio.h>
	
int main(void) {
    int a, b;
    while(scanf("%d%d", &a, &b) != EOF) {
    	printf("%d\n", a + b);
    }
    return 0;
}
C++
#include <iostream>
	
using namespace std;

int main(void) {
    int a, b;
    while(cin >> a >> b) {
    	cout << a + b << endl;
    }
    return 0;
}
Java
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);
        }
    }
}
C#
using System;

public class AplusB
{
    private static void Main()
    {
        string line;
        while((line = Console.ReadLine()) != null)
        {
            string[] tokens = line.Split(' ');
            Console.WriteLine(int.Parse(tokens[0]) + int.Parse(tokens[1]));
        }
    }
}
Python2
while True:
    try:
        (x, y) = (int(x) for x in raw_input().split())
        print x + y
    except EOFError:
        break

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值