A+B(基本输入输出3)

题目描述
输入两个数A,BA,B,输出A+BA+B的值。

输入描述
多组数据:每组由两个整数(AA和BB)构成,AA和BB之间用空格隔开,每组输入单独占一行。
当输入为"0 0"时,输入结束。"0 0"这组数据不处理。

输出描述
对于每一组测试用例,输出齐对应的和,每组数据一行。

样例输入
1 2
3 4
10 20
0 0
样例输出
3
7
30

参考代码

#include <iostream>
using namespace std;
int main(){
   int A,B,C[100];
   int i=0;
   while(1){
     cin>>A;
     cin>>B;
     if(A==0 && B==0) break;
     C[i++]=A+B;
   }
   for(int j=0;j<i;j++)
      cout<<C[j]<<endl;
 }

猜你喜欢

转载自blog.csdn.net/three_cats/article/details/90049331