-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuadrantDetermination.java
More file actions
29 lines (24 loc) · 1023 Bytes
/
Copy pathQuadrantDetermination.java
File metadata and controls
29 lines (24 loc) · 1023 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
28
29
import java.util.Scanner;
public class QuadrantDetermination {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
for (int i = 0; i < 4; i++) {
System.out.print("Enter x-coordinate: ");
int x = scanner.nextInt();
System.out.print("Enter y-coordinate: ");
int y = scanner.nextInt();
if (x > 0 && y > 0) {
System.out.println("The point lies in the first quadrant.");
} else if (x < 0 && y > 0) {
System.out.println("The point lies in the second quadrant.");
} else if (x < 0 && y < 0) {
System.out.println("The point lies in the third quadrant.");
} else if (x > 0 && y < 0) {
System.out.println("The point lies in the fourth quadrant.");
} else {
System.out.println("The point lies on an axis.");
}
}
scanner.close();
}
}