-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFind_Quadrant_of_the_coordinate_point.java
More file actions
63 lines (56 loc) · 1.26 KB
/
Find_Quadrant_of_the_coordinate_point.java
File metadata and controls
63 lines (56 loc) · 1.26 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
Write a program to accept a coordinate point in an XY coordinate system and determine in which quadrant the coordinate point lies.
"1st Quadrant": if +x,+y
"2nd Quadrant": if -x,+y
"3rd Quadrant": if -x,-y
"4th Quadrant": if +x,-y
"x axis": if x,0
"y axis": if 0,y
"Origin": if 0,0
*/
import java.util.* ;
import java.io.*;
class Solution {
public static void main(String args[]) {
int x,y;
Scanner sc=new Scanner(System.in);
x=sc.nextInt();
y=sc.nextInt();
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 if(x>0&&y<0)
{
System.out.println("4th Quadrant");
}
else if(x>0&&y==0
{
System.out.println("x axis");
}
else if(x==0&&y>0)
{
System.out.println("y axis");
}
else if(x==0&&y<0)
{
System.out.println("y axis");
}
else if(x>0&&y==0)
{
System.out.println("y axis");
}
else
{
System.out.println("at origin");
}
}
}