ACM(four)
2018-12-06 本文已影响0人
九九询
A + B Problem
Calculate A + B.
Inpout
Each line will contain two integers A and B. Process to end of file.
Output
For each case, output A + B in one line.
Examples
Sample Input
1 1
Sample Output
2
问题简述
两数求和。
程序分析
此程序需注意可输入的不止一次a,b。因此,可用while循环语句,使得每一次输入过程中,计算出相应的和。
AC程序如下:
//hdu-1000
#include<iostream>
using namespace std;
int main()
{
int a, b;
while (cin >> a >> b)
cout << a + b << endl;
return 0;
}