Skip to content
Sign upLog in
← Back to Community
3.A. If/else: Equal numbers
Profile icon
MohamadAlshabab

Given three integers. Determine how many of them are equal to each other. The program must print one of the numbers: 3 (if all are same), 2 (if two of them are equal to each other and the third one is different) or 0 (if all numbers are different).

Voters
Profile icon
MohamadAlshabab
Comments
hotnewtop
Profile icon
Cartianin

First, you need to determine the difference between these two numbers. Also, I like how it works and shows the number of similar digits. It’s simple, but creating something that works itself is always cool. You can develop into something bigger and, for example, learn the program to see the difference between integers vs real numbers https://difference-between.net/difference-between-real-numbers-and-integers/. It could be helpful to explain this difference to kids in my school. We study maths and programming at the same time. It proves to be an effective strategy because programming helps to understand math better, and math helps to be better at programming.

Profile icon
thomsoxon

It works! I didn't expect that, honestly.