您的位置:首页 > 其它

HDU 1000 A + B Problem

2016-07-16 20:46 357 查看

Problem 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

这是一道水题,很简单的。但是要注意输入的是多行,要用到while(scanf(“%d%d”,&a,&b)!=EOF)这一条语句

#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
int a, b;
int sum;
while(scanf("%d%d",&a,&b)!=EOF)
{
sum=0;
sum=a+b;
printf("%d\n",sum);
}
return 0;
}


结果

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  HDU-水题