Find quadrant in which point lies in c

Find the qudrant in which point lies in C : The following C programming code finds the quadrant which contains the given point. The point lies in the first quadrant if x and y co-ordinates are positive, it lies in second quadrant if x is negative and y is positive, it lies in thrid quadrant if both x and y are negative, otherwise the point lies in fourth quadrant.

C program to find quadrant of a point


/* Aim: To find the quadrant in which the point lies */

#include<stdio.h>

int main()
{
	int x,y;
 
	printf("\n Enter the co-ordinates (X,Y) :- ");
	scanf("%d%d",&x,&y);
 
	if((x>0) && (y>0))
		{
		printf("\n The point with (%d ,%d) lies in first quadrant \n \n",x,y);
		} 
	else if((x<0) && (y>0)) 
		{
		printf("\n The point with (%d ,%d) lies in second quadrant \n \n",x,y);
		}
	else if((x<0) && (y<0))  
		{
		printf("\n The point with (%d ,%d) lies in third quadrant \n \n",x,y);
		}
	else	{
		printf("\n The point with (%d ,%d) lies in fourth quadrant \n \n",x,y);
	}
	return 0;
}

Output :


/* Output of Above Code:-

 Enter the co-ordinates (X,Y) :- 4 4

 The point with (4 ,4) lies in first quadrant 

*/