Tuesday, 31 July 2018

Quadrant Detector

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
clrscr();
float x,y;
cout<<"¯Enter the  co-ordinates of point:- \n    Enter x co-ordinate: ";
cin>>x;
cout<<"\n    Enter y co-ordinate: ";
cin>>y;

if(x>0 && y>0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is in First quadrant";}
else if(x<0 && y>0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is in Second quadrant";}
else if(x<0 && y<0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is in Third quadrant";}
else if(x>0 && y<0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is in Fourth quadrant";}
else if(x==0 && y==0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is At Origin";}
else if(x>0 && y==0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is on X-Axis";}
else if(x<0 && y==0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is on X'-Axis";}
else if(x==0 && y>0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is on Y-Axis";}
else if(x==0 && y<0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is on Y'-Axis";}
getch();
}



===========================================================================


                                OUTPUT



No comments:

Post a Comment