Find the coordinate in which the point (x,y) lies

C program to accept x and y coordinate of a point and find the coordinate in which the point lies.

Coordinate system can be depicted as follows:

Program

#include<stdio.h>
#include<conio.h>
void main()
{
	int x, y;

    printf("Enter the x and y coordinates of a point\t:");
    scanf("%d%d",&x,&y);

    if(x == 0 && y == 0)
	printf("\nPoint lies at the origin");
    else if(x > 0 && y > 0)
	printf("\nPoint lies in first quadrant");
    else if(x < 0 && y > 0)
	printf("\nPoint lies in second quadrant");
    else if(x < 0 && y < 0)
	printf("\nPoint lies in third quadrant");
    else if(x > 0 && y < 0)
	printf("\nPoint lies in fourth quadrant");
    else if(y == 0)
	printf("\nPoint lies on X-axis");
    else if(x == 0)
	printf("\nPoint lies on Y-axis");

    getch();
}

Output

********** Run1 ********** 

Enter the x and y coordinates of a point        :4
5

Point lies in first quadrant


********** Run1 ********** 

Enter the x and y coordinates of a point        :4
-3

Point lies in fourth quadrant

Explanation

There are 7 conditions that needs to be checked to determine where does the points lies in the cartesian plane

If at origin then, x = 0 and y = 0
If in first quadrant then, x > 0 and y > 0
If in second quadrant then, x < 0 and y > 0
If in third quadrant then, x < 0 and y < 0
If in fourth quadrant then, x > 0 and y < 0
If in x-axis then, y = 0
If in y-axis then, x = 0