## C Programming

### Check the axis of a point

#### Objective:

Input a point(x,y), write a program to find out if it lies on the x-axis, y-axis, or at the origin (0,0).

#### Problem / Solution:

#include<stdio.h> int main() { int x,y; printf("Enter a point (x,y): "); scanf("%d%d",&x,&y); if(x == 0 && y == 0) { printf("Point(%d,%d) is on origin",x,y); }else if(x == 0 && y != 0) { printf("Point(%d,%d) is on x-axis",x,y); }else if(x != 0 && y == 0) { printf("Point(%d,%d) is on y-axis",x,y); }else { printf("Point doesn't lie on any axis, nor origin"); } return 0; }

#### Sample Output:

Enter a point (x,y): 0 0 Point(0,0) is on origin Enter a point (x,y): 5 0 Point(5,0) is on y-axis Enter a point (x,y): 0 6 Point(0,6) is on x-axis Enter a point (x,y): 5 5 Point doesn't lie on any axis, nor origin