Accept the x and y coordinate of a point and find the quadrant in which the point lies.


void main()
{
 int co1,co2;

 printf("Input the values for X and Y coordinate : ");
 scanf("%d %d",&co1,&co2);

 if( co1 > 0 && co2 > 0)
   printf("The coordinate point (%d,%d) lies in the First quandrant.\n",co1,co2);
 else if( co1 < 0 && co2 > 0)
   printf("The coordinate point (%d,%d) lies in the Second quandrant.\n",co1,co2);
 else if( co1 < 0 && co2 < 0)
   printf("The coordinate point (%d, %d) lies in the Third quandrant.\n",co1,co2);
 else if( co1 > 0 && co2 < 0)
   printf("The coordinate point (%d,%d) lies in the Fourth quandrant.\n",co1,co2);
 else if( co1 == 0 && co2 == 0)
   printf("The coordinate point (%d,%d) lies at the origin.\n",co1,co2);

}
Accept the x and y coordinate of a point and find the quadrant in which the point lies. Accept the x and y coordinate of a point and find the quadrant in which the point lies. Reviewed by on August 30, 2019 Rating: 5
Powered by Blogger.