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.
- First, check if the sides can form a triangle. If not, return "Invalid".
- 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
Input
a=5, b=5, c=5Output
"Equilateral"Explanation: All sides equal.
02EXAMPLE 2
Input
a=1, b=2, c=10Output
"Invalid"Explanation: 1+2 is not > 10.
Constraints
- Sides are positive integers.
- Return the string name exactly as defined (case-sensitive).
Control FlowMathGeometry
JavaScriptSystem handles I/O — write your function only
Loading...
4 Hidden
Input Arguments
a5
b5
c5
Expected Output
Equilateral
Click RUN to test your solution