-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay6.java
More file actions
48 lines (37 loc) · 1.22 KB
/
Day6.java
File metadata and controls
48 lines (37 loc) · 1.22 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
/*
Day 6 coding Statement: Write a program to find the Quadrants in which coordinates lie
Get the value of x and y coordinates as input from the user and check in which quadrant the point lies and print it.
Input
10 20
Output
This point lies in first quadrant.
Input
-10 20
Output
This point lies in second quadrant.
*/
import java.util.*;
class Day6 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x,y;
System.out.println("Enter (x,y) values : ");
x=sc.nextInt();
y=sc.nextInt();
if(x==0 && y==0){
System.out.println("This point lies on origin.");
}else if(x==0 & y!=0){
System.out.println("This point lies on y-axis.");
}else if(x!=0 && y==0){
System.out.println("This point lies on x-axis");
}if(x>0 && y>0){
System.out.println("This point lies in first quadrant.");
}else if(x<0 && y>0){
System.out.println("This point lies in second quadrant.");
}else if(x<0 && y<0){
System.out.println("This point lies in third quadrant.");
}else if(x>0 && y<0){
System.out.println("This point lies in fourth quadrant.");
}
}
}