Problem1002--A+B Problem

1002: A+B Problem

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 2736  Solved: 1217
[Submit] [Status] [Web Board] [Creator:]

Description

calculate A+B

注意测试数据有多组,请以文件结尾作为结束标记(EOF)

Input

A B

Output

A+B的值

Sample Input Copy

1 2
1 1

Sample Output Copy

3
2

HINT

标准代码(仅供参考):

C:

#include <stdio.h>
int main(){
    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(){
    int a,b;
    while(cin >> a >> b)
        cout << a+b << endl;
return 0;
}
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);
}
}
}

Source/Category