「HD_ACM」A+B for Input-Output Practice (III)

来源:互联网 发布:sql 数据库链接 编辑:程序博客网 时间:2024/05/02 01:51
Problem Description
Your task is to Calculate a + b.
->你的任务是计算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.
->输入包含多个测试案例。每个测试用例包含一对整数a和b,每行一个整数对。一个包含0个0终止输入和测试用例是不能处理的测试用例
 
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. 
->对于每一对输入整数a和b你应该输出一行,a和b的值用一行输出在一行
 
题目解析
          注意a 和 b 同时为0 的时候才退出程序,
代码解析
#include <stdio.h>#include <stdlib.h>int main(){  int a, b;  while(scanf("%d %d" , &a ,&b) !=EOF && a !=0 || b != 0)  {    printf("%d\n" , a+b);  }  return 0;}


0 0