Contents

``````// Java program to read coordinate points

import java.util.Scanner;

public class Main {
static int determineQuadrant(int X, int Y) {
if (X == 0 && Y == 0)
return 0;
else if (X > 0 && Y > 0)
return 1;
else if (X < 0 && Y > 0)
return 2;
else if (X < 0 && Y < 0)
return 3;
else if (X > 0 && Y < 0)
return 4;
return -1;
}

public static void main(String[] args) {
Scanner SC = new Scanner(System.in);

int X;
int Y;

int ret = 0;

System.out.printf("Enter the value of X: ");
X = SC.nextInt();

System.out.printf("Enter the value of Y: ");
Y = SC.nextInt();

if (ret == 0)
System.out.printf("Point (%d, %d) lies at the origin\n", X, Y);
else if (ret == 1)
System.out.printf("Point (%d, %d) lies in the First quadrant\n", X, Y);
else if (ret == 2)
System.out.printf("Point (%d, %d) lies in the Second quadrant\n", X, Y);
else if (ret == 3)
System.out.printf("Point (%d, %d) lies in the Third quadrant\n", X, Y);
else if (ret == 4)
System.out.printf("Point (%d, %d) lies in the Fourth quadrant\n", X, Y);
}
}
``````

## Output

``````Enter the value of X: 20
Enter the value of Y: 30
Point (20, 30) lies in the First quadrant
``````

### Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.