大家好,本篇内容讲解的是ZOJ ACM竞赛的编号为1001的题目
原题如下:
Calculate a + b
Input
The input will consist of a series of pairs of integers a and b,separated by a space, one pair of integers per line.
Output
For each pair of input integers a and b you should output the sum of a and b in one line,and with one line of output for each line in input.
Sample Input
1 5
Sample Output
6
//摘自ZOJ (pintia.cn)
翻译结果:
计算 a + b
输入
输入将由一系列整数对a和b组成,由空格分隔,每行一对整数。
输出
对于每对输入整数 a 和 b,您应该在一行中输出 a 和 b 的总和,并为输入中的每行输出一行输出。
示例输入
1 5
示例输出
6
以下为我写的代码:
#include<stdio.h>
int main(void)
{
int a, b;
while (scanf("%d%d", &a, &b) != EOF) printf("%d\n", a + b);
return 0;
}
非常简单,就不过多解释了