The Quadrant Navigator

MediumAcc. 92.4%
+30 XP 12

Navigator's Map

In the Cartesian plane, every coordinate (x, y) tells a story. Your goal is to identify which "Quadrant" a point belongs to, or if it sits exactly on the axes of the world.

The Map Rules

  • Origin: Both x and y are 0.
  • X-axis: y is 0, but x is not.
  • Y-axis: x is 0, but y is not.
  • Quadrant 1: x and y are both positive.
  • Quadrant 2: x is negative, y is positive.
  • Quadrant 3: x and y are both negative.
  • Quadrant 4: x is positive, y is negative.

Your Task

Receive x and y and return the correct string (Origin, X-axis, Y-axis, Quadrant 1, Quadrant 2, etc.).

01EXAMPLE 1

Inputx=5, y=5
Output"Quadrant 1"

Explanation: Both positive.

02EXAMPLE 2

Inputx=0, y=-10
Output"Y-axis"

Explanation: On the vertical line.

Constraints

  • Return the string exactly as shown in the rules.
  • Ensure "Origin" check happens first.
Control FlowMathGeometry
JavaScript
Loading...
4 Hidden

Input Arguments

x0
y0

Expected Output

Origin

Click RUN to test your solution