**Questions**:

Write a C program to accept a coordinate point in an XY coordinate system and determine in which quadrant the coordinate point lies.

A Cartesian coordinate system specifies each point uniquely in a plane by a pair of numerical coordinates.

There are 4 quadrants in a cartesian coordinate system.

- 1st Quadrant, both (x,y) co-ordinates are (+,+).
- 2nd Quadrant, both (x,y) co-ordinates are (-,+).
- 3rd Quadrant, both (x,y) co-ordinates are (-,-).
- 4th Quadrant, both (x,y) co-ordinates are (+,-).

If x, y values are 0,0 then it lies in a center that is the origin. And the following program displays them accordingly depending on the coordinates.

**Program to Find the Quadrant in which the given co ordinates lies in C**.

**Source Code:**

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 | #include <stdio.h> int main() { int x, y; printf("Enter the Coordinates(x,y): "); scanf("%d %d", &x, &y); //check for the condition. if (x > 0 && y > 0) { printf("The coordinate (%d,%d) lies in the First quadrant(+,+)\n", x, y); } else if (x > 0 && y < 0) { printf("The coordinate (%d,%d) lies in the Second quadrant(+,-)\n", x, y); } else if (x < 0 && y < 0) { printf("The coordinate (%d,%d) lies in the Third quadrant(-,-)\n", x, y); } else if (x < 0 && y > 0) { printf("The coordinate (%d,%d) lies in the Fourth quadrant(-,+)\n", x, y); } return 0; } |

**Output:**

`Enter the Coordinates(x,y): -3 4 `

The coordinate (-3,4) lies in the Fourth quadrant(-,+)