Given a point (x, y), write a program to find out if it lies on the x-axis, y-axis or at the origin, viz. (0, 0).
void main()
{
float x,y;
printf("\nInput the(x,y) values");
scanf("%f%f",&x,&y);
if(x==0&&y==0)
printf("\nThe point lies on the origin");
else if(x==0&&y!=0)
printf("\nThe point lies on the y-axis");
else if(x!=0&&y==0)
printf("\nThe point lies on the x-axis");
else
printf("\nThe point does not lie on any axis or origin");
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment