Question #24224

given a point (x,y),write a program to find out if lies on the x-axis and y-axis or at the origin and which quardent they belong to

Expert's answer

#include <iostream>

using namespace std;

int main (){

double x,y;

cout<<"Enter x, y\n";

cin>>x>>y;

if (x == 0 && y == 0) cout<< "point at the origin\n";

else if (x == 0) cout<< "point at the x-axis\n";

else if (y == 0) cout<< "point at the y-axis\n";

else if (x > 0 && y > 0) cout<< "point at the first quadrant\n";

else if (x < 0 && y > 0) cout<< "point at the second quadrant\n";

else if (x < 0 && y < 0) cout<< "point at the third quadrant\n";

else if (x > 0 && y < 0) cout<< "point at the fourth quadrant\n";

system("pause");

return 0;

}

using namespace std;

int main (){

double x,y;

cout<<"Enter x, y\n";

cin>>x>>y;

if (x == 0 && y == 0) cout<< "point at the origin\n";

else if (x == 0) cout<< "point at the x-axis\n";

else if (y == 0) cout<< "point at the y-axis\n";

else if (x > 0 && y > 0) cout<< "point at the first quadrant\n";

else if (x < 0 && y > 0) cout<< "point at the second quadrant\n";

else if (x < 0 && y < 0) cout<< "point at the third quadrant\n";

else if (x > 0 && y < 0) cout<< "point at the fourth quadrant\n";

system("pause");

return 0;

}

## Comments

## Leave a comment