Course of Raku / Essentials / Conditional checks / Exercises

How many numbers are equal?

Problem

Create a program that takes three integer numbers from the user and tells how many of them are equal. The program should be able to work with both positive and negative numbers.

Example

A possible run of the program is shown below:

$ raku how-many-equal-numbers.raku
Number 1: 3
Number 2: -4
Number 3: 3
2

If all three numbers are different, the program prints 0.

Solution

See the solution

Next exercise

💪 Leap year

Course navigation

Code blocks / Local variables   |   Loops