杭电1091(今天的伤痕会是你明天的坚强)

Problem Description

Your task is to Calculate a + b.
Input
Input contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be processed.
 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 10 20 0 0
Sample Output
6 30

问题描述

你的任务是计算a + b。

输入

输入包含多个测试用例。每个测试用例包含两个整数a和b,每行一对整数。测试用例包含0 0终止输入和这个测试用例不是要处理。

输出

对于每一对输入整数a和b,你应该输出的总和a和b在一行,和一行输出输入的每一行。

样例输入

1 5

10 20

0 0

样例输出

6

30

正解

#include<stdio.h>
int main()
{
int a,b;
while(scanf("%d%d",&a,&b)!=EOF)
{ if(a==0&&b==0)
printf("\0");
else
printf("%d\n",a+b);
}
}

posted on 2015-04-20 18:36  Randy77  阅读(256)  评论(0编辑  收藏  举报

导航