Сomparison

Task

In three-digit number find which digit is bigger — the most right or the most left. If all digits are equal, enter as an result the word «equals».

Similar task to this can be found here.

 

Tests

Try to find all possible combinations distributed by growing. Should be not less than 13 combinations.

Input Output
555  equals
554  5
545  equals
455  5
557  7
575  equals
755  7
321  3
312  3
231  3
213  3
123  3
132  3

Solution

With «if» statement:

Code refactoring

 

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *