https://www.acmicpc.net/problem/14681
흔한 수학 문제 중 하나는 주어진 점이 어느 사분면에 속하는지 알아내는 것이다. 사분면은 아래 그림처럼 1부터 4까지 번호를 갖는다. "Quadrant n"은 "제n사분면"이라는 뜻이다.
<script>
#include <stdio.h>
int main() {
int x, y;
scanf("%d %d", &x, &y); // int형 변수 x, y의 값을 받아온다.
if (x > 0) {
if (y > 0) {
printf("1");
}
else {
printf("4");
}
}
else {
if (y > 0) {
printf("2");
}
else {
printf("3");
}
}
return 0;
}
</script>