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
1
Expert's answer
2013-02-28T08:50:35-0500
#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";
Comments
Leave a comment