-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuadrant.java
More file actions
27 lines (24 loc) · 781 Bytes
/
Quadrant.java
File metadata and controls
27 lines (24 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.Scanner;
public class Quadrant {
static void findQuadrant(int x, int y) {
if (x == 0 && y == 0) {
System.out.println("Origin");
} else if (x >= 0 && y >= 0) {
System.out.println("1st Quadrant");
} else if (x < 0 && y >= 0) {
System.out.println("2nd Quadrant");
} else if (x < 0 && y < 0) {
System.out.println("3rd Quadrant");
} else {
System.out.println("4th Quadrant");
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter x,y : ");
int x = scanner.nextInt();
int y = scanner.nextInt();
findQuadrant(x, y);
scanner.close();
}
}