index | submit | rank | book

triangle1 – Three Triangle Types (challenge)

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.)

triangle types: scalene, isosceles, equilateral, impossible

Write a program that given three edge sizes determines whether a triangle is scalene, isosceles, equilateral or impossible.

Input and Output

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.

Example input 1

3 4 5

Example output 1

scalene

Example input 2

3 3 1

Example output 2

isosceles

Example input 3

6 2 3

Example output 3

impossible

Example input 4

4 4 4

Example output 4

equilateral

Scoring

Hints

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 first: good1 signum1

try next: factorial1

index | submit | rank | book

Copyright © 2020-2023 Rudy Matela