14681번: 사분면 고르기
점 (x, y)의 사분면 번호(1, 2, 3, 4 중 하나)를 출력한다.
www.acmicpc.net
풀이
#include <iostream>
using namespace std;
int main()
{
//created by devBong on 2022/08/16
int A, B;
cin >> A >> B;
if (A > 0 && B > 0)
{
cout << 1;
}
else if(A < 0 && B < 0)
{
cout << 3;
}
else if (A > 0)
{
cout << 4;
}
else
{
cout << 2;
}
}
해설
설명은 생략
'else if ( Algorithm ) > baekjoon' 카테고리의 다른 글
[백준: 2480번] 주사위 세개 (C++) (0) | 2022.08.29 |
---|---|
[백준: 10172번] 개 (C++) (0) | 2022.08.29 |
[백준: 10171번] 고양이 (C++) (0) | 2022.08.29 |
[백준: 2588번] 곱셈 (C++) (0) | 2022.08.29 |
[백준: 10430번] 나머지 (C++) (0) | 2022.08.29 |