Flow controls: Conditions · 18 / 22 Exercise Medium

Classifying a triangle

Objective

Three lengths form a triangle only if each side is smaller than the sum of the other two. If they do, it is classified by its sides.

Instructions

  • Read three decimal lengths, one per line.
  • If any is greater than or equal to the sum of the other two, show Not a triangle.
  • Otherwise show Equilateral (three equal sides), Isosceles (exactly two equal) or Scalene (all different).
Input
3
4
5
Output
Scalene

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise