Baekjoon/단계별로 풀어보기
[BOJ/백준] 10952번 A+B - 5 C++ 문제 풀이
s_ih_yun
2020. 9. 21. 21:57
728x90
단계별로 풀어보기 - while문 - [1단계] 10952번
문제
문제 링크 : www.acmicpc.net/problem/10952
10952번: A+B - 5
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
입력 복사 :
1 1 2 3 3 4 9 8 5 2 0 0
CODE
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int a, b;
while (1) {
cin >> a >> b;
if (a != 0 && b != 0) {
cout << a + b << '\n';
}
else {
break;
}
}
}
결과
728x90