Course of Raku / Addendum 🆕 / Flow and functions / Control flow and logic / Exercises

Kind of triangle

Problem

Given three side lengths, decide whether they form an equilateral, isosceles, or scalene triangle — or no triangle at all when the longest side is too long. Classify (3, 3, 3), (3, 3, 5), (3, 4, 5), and (1, 2, 10).

Example

The program prints:

3 3 3: equilateral
3 3 5: isosceles
3 4 5: scalene
1 2 10: invalid

Solution

See the solution

Course navigation

Solution: Leap years   |   Solution: Kind of triangle