Coordinates of a Point
Adapted by Neilor Tonin, URI
Brazil
Timelimit: 1

If the point is at the origin, write the message "Origem".
If the point is over X axis write "Eixo X", else if the point is over Y axis write "Eixo Y".
Input
The input contains the coordinates of a point.
Output
The output should display the quadrant in which the point is.
Input Sample | Output Sample |
4.5 -2.2 | Q4 |
0.1 0.1 | Q1 |
0.0 0.0 | Origem |
// email:sagor.cse.just@gmail.com
#include<stdio.h>
int main()
{
float x,y;
scanf("%f%f",&x,&y);
if(x==0 && y==0)
printf("Origem\n");
else if(x>0 && y>0)
printf("Q1\n");
else if(x<0 && y>0)
printf("Q2\n");
else if(x<0 && y<0)
printf("Q3\n");
else if(x>0 && y<0)
printf("Q4\n");
else if(y==0)
printf("Eixo X\n");
else if(x==0)
printf("Eixo Y\n");
return 0;
}
Comments
Post a Comment