Sunday, September 9, 2018

19. WAP to determine whether a point (x,y) lies on the x-axis, y-axis or at the origin i.e (0,0).

#include<stdio.h>
#include<conio.h>
void main()
{
   int x,y;
   printf("Enter the X co-ordinate of the point: ");
   scanf("%d",&x);
   printf("Enter the Y co-ordinate of the point: ");
   scanf("%d",&y);
   if(x==0 && y==0)
printf("\nPoint lies at the origin.");
   else if(x==0)
    printf("\nPoint lies on the y-axis.");
   else if(y==0)
    printf("\nPoint lies on the x-axis.");
   else
    printf("\nPoint does not lie on any axis.");
   getch();

}


Output:






Please have a look at the below lesson posted on my YouTube channel:


No comments:

Post a Comment