14681 제출

박철진·2021년 7월 21일
0

알고리즘

목록 보기
1/5
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int x = scan.nextInt();
        int y = scan.nextInt();

        if(x > 0 && y > 0) {
            System.out.println(1);
        } else if(x < 0 && y > 0) {
            System.out.println(2);
        } else if(x < 0 && y < 0) {
            System.out.println(3);
        } else if(x > 0 && y < 0) {
            System.out.println(4);
        }
    }
}

음수에 대해 고민이 많았었는데 생각보다 간단했다

profile
개발자를 위해 기록하는 습관

0개의 댓글