본문 바로가기
💻 문제풀고 정리하기 +/백준

[백준 Java] 14681: 사분면 고르기

by 종이빨대 2023. 8. 29.
TOP

목차

    1. 문제

    2. 맞춘코드

    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.IOException;
    
    public class bj14681{
    	public static void main(String[] args) throws IOException {
    		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    		int x, y, qua;
    
    		x = Integer.parseInt(br.readLine());
    		y = Integer.parseInt(br.readLine());
    
    		if(x>0 && y>0) qua = 1;
    		else if(x>0 && y<0) qua = 4;
    		else if(x<0 && y>0) qua = 2;
    		else{qua = 3;}
    
    		System.out.println(qua);
    	}
    }