백준 algorithm

백준 10952 - A+B -5

cosmohoo 2019. 9. 3. 00:04
반응형

문제설명

if문을 통해 입력을 멈추면 간단히 해결가능하다.

 

#include <iostream>
using namespace std;

int main()
{
	int a, b = 1;
	while (1)
	{
		cin >> a >> b;
		if (a == 0 && b == 0)
			break;
		else
		cout << a + b << endl;
	}

	return 0;
}
반응형