URI - BEECROWD - BEE 1041 - Coordinates of a Point Solution in C,C++,Python

URI - BEECROWD - BEE Online Judge Solution  1041 | Coordinates of a Point - URI - BEECROWD - BEE 1041 Solution in C,C++,Python

Write an algorithm that reads two floating values (x and y), which should represent the coordinates of a point in a plane. Next, determine which quadrant the point belongs, or if you are at one of the Cartesian axes or the origin (x = y = 0).

If the point is at the origin, write the message "Origem".

If the point is at X axis write "Eixo X", else if the point is at 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 SampleOutput Sample

4.5 -2.2

Q4

0.1 0.1

Q1

0.0 0.0

Origem

URI Online Judge Solution  1041 | Coordinates of a Point - URI 1041 Solution in C,C++,Python :


  URI Problem 1041 Solution in C :   

  URI Online Judge 1041 Solve  in C :                                                                             
#include <stdio.h>
int main()
{
    double X,Y;
    scanf ("%lf%lf", &X, &Y);

    if (X + Y == 0) printf("Origem\n");
    else if (X == 0) printf("Eixo Y\n");
    else if (Y == 0) printf("Eixo X\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");
    return 0;
}

0 Response to URI - BEECROWD - BEE 1041 - Coordinates of a Point Solution in C,C++,Python

Post a Comment