1F - A+B for Input-Output Practice (III)

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

// 先上代码对比
1F - A+B for Input-Output Practice (III)
1 #include<stdio.h>
2 int main()
3 {
4     int a, b, t, i;
5     while(scanf("%d %d", &a, &b), a!=0&&b!=0)
6         printf("%d\n", a+b);
7     return 0;
8 }
WA 1F - A+B for Input-Output Practice (III)
1 #include<stdio.h>
2 int main()
3 {
4     int a, b, t, i;
5     while(scanf("%d %d", &a, &b), !(a==0&&b==0))
6         printf("%d\n", a+b);
7     return 0;
8 }
AC
//
  a!=0 && b!=0 !(a==0 && b==0)
a真b真
a真b假
a假b真
a假b假

// !(a==0&&b==0) <=> a||b
// 插入补充:命名文件时不要用空格!!!
  例如:一开始我把WA的文件命名为“F”,把AC的文件命名为“F test”. 结果运行“F test”的结果和“F”的一样.
  后来我运行了如下代码
1F - A+B for Input-Output Practice (III)
 1 #include<stdio.h>
 2 int main()
 3 {
 4     int a=0, b=2;
 5     while(a!=0&&b!=0)
 6     {
 7         printf("%d\n", a+b);
 8     }
 9     return 0;
10 }
F test2
  结果还是和“F”一样!!!大概执行程序的时候读程序名读到空格就结束吧
上一篇:GTD Practice


下一篇:Java毕业设计+现成产品 —>基于J2EE的房屋租赁系统的设计与实现