一道ACM的入门题:A+B for Input-Output Practice1(入门)DescriptionYour task is to Calculate a + b.InputInput 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
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 16:49:14
一道ACM的入门题:A+B for Input-Output Practice1(入门)DescriptionYour task is to Calculate a + b.InputInput 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
一道ACM的入门题
:A+B for Input-Output Practice1(入门)DescriptionYour task is to Calculate a + b.InputInput 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.OutputFor 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 Input1 5
10 20
0 0Sample Output6
30我的答案是:#include
int main()
{
int a,b,s;
while(scanf("%d%d",&a,&b)!=EOF)
if((a!=0)&&(b!=0))
{
s=a+b;
printf("%d\n",s);
}
else printf("");
return 0;
}但提交后是“WRONG ANWSER"请高手指点错在哪了,该怎么改
一道ACM的入门题:A+B for Input-Output Practice1(入门)DescriptionYour task is to Calculate a + b.InputInput 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的时候结束呀!而你的不是呀!