Program to tell about direction input x or y axis in plan and implement in c c++ code example
#include<stdio.h>
#include<conio.h>
void main(void)
{
int x=0,y=0;
clrscr();
printf("\nEnter x : ");
scanf("%d",&x);
printf("\nEnter y : ");
scanf("%d",&y);
if(x==0 && y>0)
printf("\nDirected to North");
else if(x>0 && y==0)
printf("\nDirected to EAST");
else if(x<0 && y==0)
printf("\nDirected to WEST");
else if(x==0 && y<0)
printf("\nDirected to SOUTH");
else if(x>0 && y>0)
printf("\nDirected to NORTHEAST");
else if(x<0 && y>0)
printf("\nDirected to NORTHWEST");
else if(x<0 && y<0)
printf("\nDirected to SOUTHWEST");
else if(x>0 && y<0)
printf("\nDirected to SOUTHEAST");
else
printf("\nORIGON");
getch();
printf("\n\nPress any key to terminate...");
return(0);
}