The Triangle Oracle

MediumAcc. 82.1%
+30 XP 12

Geometry Laws

A triangle can only exist if the sum of any two sides is strictly greater than the third side (a + b > c). If this law is violated, the shape cannot close.

The Assignment

Your function receives three numbers: a, b, c.

  1. First, check if the sides can form a triangle. If not, return "Invalid".
  2. If valid, classify it as:
    • "Equilateral": All three sides are equal.
    • "Isosceles": Exactly two sides are equal.
    • "Scalene": No two sides are equal.

01EXAMPLE 1

Inputa=5, b=5, c=5
Output"Equilateral"

Explanation: All sides equal.

02EXAMPLE 2

Inputa=1, b=2, c=10
Output"Invalid"

Explanation: 1+2 is not > 10.

Constraints

  • Sides are positive integers.
  • Return the string name exactly as defined (case-sensitive).
Control FlowMathGeometry
JavaScript
Loading...
4 Hidden

Input Arguments

a5
b5
c5

Expected Output

Equilateral

Click RUN to test your solution