Title description
Calculate A + B.
Input
Each line will contain two integers A and B. Process to end of file.
Output
For each case, output A + B in one line.
Sample Input
1 1
Sample Output
2
Ideas
First explain the meaning of the question: input two integers a and b, calculate the sum of a and b, and output.
It doesn't sound so difficult~ Mainly pay attention to multiple sets of input.
C language code:
#include<stdio.h>
int main()
{
int a , b;
while(scanf("%d %d",&a, &b) != EOF) //成功AC的关键
printf("%d\n",a + b);
return 0;
}
C++ code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a, b;
while(cin >> a >> b)
cout << a + b << endl;
return 0;
}