Every triangle can be classified as either scalene, isosceles or equilateral:
(Some authors consider equilateral to be a special case of isosceles. For the purpose of this exercise, we use Euclid’s original definition and consider isosceles triangles those with exactly two edges of the same size.)
Write a program that given three edge sizes determines whether a triangle is scalene, isosceles, equilateral or impossible.
The input consists of a single line with three natural numbers x, y and z where 0 < x, y, z < 100
The output should contain a single line with just
scalene
,
isosceles
,
equilateral
or impossible
.
3 4 5
scalene
3 3 1
isosceles
6 2 3
impossible
4 4 4
equilateral
If are having trouble to get a full score in this exercise, try to come up with other test cases besides the ones given on the example inputs. Does your program still produce the expected results on them? What if you change the order in which the sides are given?
try next: factorial1
Copyright © 2020-2021 Rudy Matela