Header Ads Widget

c program for Coordinate point in a XY coordinate system

Here in this post we will write a c program to find that a given is point is lies in which co-ordinates . So first we have to know that all about Co-ordinates  points. the points (a,b) lies in first quadrant , (-a,b)  lies in second quadrant . point (-a,-b) lies in the third quadrant and the point (a,-b) lies in the fourth quadrant.  





Code:-
#include<stdio.h>
int main()
{
int x,y;
printf("Enter the value of x and y coordinate: ");
scanf("%d%d",&x,&y);
if(x>0 && y>0)
printf("The coordinate point (%d,%d) lies in the First quadrant",x,y);
else if(x<0 && y>0)
printf("The coordinate point (%d,%d) lies in the second quadrant",x,y);
else if(x<0 && y<0)
printf("The coordinate point (%d,%d) lies in the third quadrant",x,y);
else if(x>0 && y<0)
printf("The coordinate point (%d,%d) lies in the Fourth quadrant",x,y);
else if(x==0 && y==0)
printf("The coordinate point (%d,%d) lies in the origin",x,y);
return 0;
}


Output:-
Enter the value of x and y coordinate: 7 9
The coordinate point (7,9) lies in the First quadrant



keyword:- ,write a program that takes the x y coordinates of a point in the cartesian plane,
,coordinates in c programming,
,how to print coordinates in c,
,how to store coordinates in c,
,quadrant of a point with given coordinates x y in c,
,c program to find quadrant of a point,
,accept the x and y coordinate of a point and find the quadrant in which the point lies,
,coordinates in c programming,
,how to print coordinates in c,
,how to store coordinates in c,
,how to print coordinates in c++,
,c program to find quadrant of a point,
,write a program that takes the x-y coordinates of a point in the cartesian plane,

Recommended Post:

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-