描述
输入两个自然数,输出他们的和
格式
输入格式
两个自然数x和y 0 <= x, y <= 327670<=x,y<=32767
输出格式
一个数,即x和y的和
样例
样例输入
123 500
样例输出
623
答案:
C++ Code
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a + b << endl;
return 0;
}
C Code
#include <stdio.h>
int main()
{
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", a + b);
return 0;
}
Free Pascal Code
var a,b:longint;
begin
readln(a,b);
writeln(a+b);
end.
Java Code
import java.io.*;
import java.util.Scanner;
public class Main {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(a + b);
}
}