Conditional Question:
source:
http://101cproblems.com/problem-25/
Problem 25: Coordinate
Take two integers indicating the x and y coordinate of a two-dimensional graph paper where the center point is x = 0 and y = 0. Now print the quadrant of the given point. [If user gives input (4,5) you should print ‘First quadrant’; If user gives input (-4,-5) you should print ‘Third quadrant’ ]
code:
#include<stdio.h>
int main()
{
int x,y;
scanf("%d %d",&x,&y);
if(x==0 && y==0)
{
printf("centre point");
}
if(x>0 && y>0)
{
printf("1st quadrant");
}
if(x>0 && y<0)
{
printf("2nd quadrant");
}
if(x<0 && y<0)
{
printf("3rd quadrant");
}if(x>0 && y<0)
{
printf("4th quadrant");
}
return 0;
}
Theory:
http://www.mathsisfun.com/data/cartesian-coordinates.html