nyoj 1 A + B Problme

A+B Problem

时间限制:3000 ms  |  内存限制:65535 KB |难度:0
描述
  此题为练手用题,请大家计算一下a+b的值.
输入
  输入两个数,a,b
输出
  输出a+b的值
样例输入
  2 3

样例输出
  5

C语言版:
#include<stdio.h>
int main()
{
  int a,b;
  scanf("%d%d",&a,&b);
  printf("%d\n",a+b);
} 

Java jdk 1.4 版

import java.io.*;
import java.util.*;

public class Main
{
  public static void main (String args[]) throws Exception
  {
    BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
    String line = stdin.readLine();
    StringTokenizer st = new StringTokenizer(line);
    int a = Integer.parseInt(st.nextToken());
    int b = Integer.parseInt(st.nextToken());
    System.out.println(a+b);
  }
}

C++版: 

#include <iostream>
#include <algorithm>

using namespace std;

int main() 
{
    int a, b;
    cin >>a >>b;
    cout <<a+b <<endl;
    return 0;
}
原文地址:https://www.cnblogs.com/GetcharZp/p/8920396.html