zzulioj 1080: a+b(多实例测试3)

题目描述
计算A+B
输入
输入数据有多组。
每组一行,为两个整数A, B。输入0 0表示输入结束,该组输入不用处理。
输出
对每行输入,输出A+B的值,单独占一行。
样例输入 Copy
1 2
0 0

样例输出 Copy
3
提示
输入0 0结束,本题可以在循环条件中读取键盘输入并同时进行判断:
while(scanf("%d%d",&a,&b), a!=0||b!=0)
printf("%d\n",a+b);

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

猜你喜欢

转载自blog.csdn.net/m0_53024529/article/details/113653048