c语言题目为何答案错误(杭电oj1091)
ProblemDescriptionYourtaskistoCalculatea+b.InputInputcontainsmultipletestcases.Eachte...
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
问题描述你的任务是计算一个+ B输入包含多个测试案例。每一个测试用例包含一对整数,每行一对整数。一个包含0个0的测试用例终止输入,这个测试用例是不被处理的。输出为每对输入一个整数,你应该输出一个和一个的总和,并在一个线,并与一行输出为每一行的输入。样品输入5 10 20 0 0 6样品输出30
#include<stdio.h>
int main()
{int a,b,c;
while (scanf("%d %d",&a,&b)!=EOF&&(a!=0&&b!=0) ) //直到a,b=0结束
{c=a+b;
printf("%d\n",c);
}
} 展开
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
问题描述你的任务是计算一个+ B输入包含多个测试案例。每一个测试用例包含一对整数,每行一对整数。一个包含0个0的测试用例终止输入,这个测试用例是不被处理的。输出为每对输入一个整数,你应该输出一个和一个的总和,并在一个线,并与一行输出为每一行的输入。样品输入5 10 20 0 0 6样品输出30
#include<stdio.h>
int main()
{int a,b,c;
while (scanf("%d %d",&a,&b)!=EOF&&(a!=0&&b!=0) ) //直到a,b=0结束
{c=a+b;
printf("%d\n",c);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询