Title description
Input 2 integer x and y values from the keyboard to indicate a coordinate point on the plane, determine which quadrant the coordinate point is in, and output the corresponding result.
Input
Input the x and y values to represent a coordinate point. The coordinate point will not be on the x-axis and y-axis, nor will it be at the origin.
Output The
corresponding quadrants of the output, the numbers 1, 2, 3, 4 correspond to the four quadrants respectively. >
Sample input Copy
1
1Sample output Copy
1
#include<stdio.h>
int main()
{
int x, y;
scanf("%d%d",&x,&y);
if(x>0&&y>0)
printf("1\n");
else if(x<0&&y>0)
printf("2\n");
else if(x<0&&y<0)
printf("3\n");
else
printf("4\n");
return 0;
}