问题 1000. -- A + B Problem

1000: A + B Problem

时间限制: 1 Sec  内存限制: 128 MB
提交: 387  解决: 185
[提交][状态][讨论版]

题目描述

Calculate A + B.


输入

Each line will contain two integers A and B. Process to end of file.

输出

For each case, output A + B in one line.

样例输入

1 1

样例输出

2

提示







下面是 1000题的参考答案



C++:


 #include <iostream>
using namespace std;
int main(){
int a,b;
while(cin >> a >> b)
cout << a+b << endl;
return 0;
}

C:

 #include <stdio.h>
int main(){
int a,b;
while(scanf("%d %d",&a, &b) != EOF)
printf("%d\n",a+b);
return 0;
}

PASCAL:

 program p1001(Input,Output); 
var
a,b:Integer;
begin
while not eof(Input) do
begin
Readln(a,b);
Writeln(a+b);
end;
end.





Java:

 import java.util.*;
public class Main{
public static void main(String args[]){
Scanner cin = new Scanner(System.in);
int a, b;
while (cin.hasNext()){
a = cin.nextInt(); b = cin.nextInt();
System.out.println(a + b);
}
}
}

来源

[提交][状态]