jeudi 5 novembre 2020

Finding the middle number out of three (without if-else and such)

I've been asked to make a short program that gets 3 numbers, and print the middle one i.e. 3 2 0 -> "middle number is 2" another example : 4 4 5 -> middle number is 4 (the user may enter the same number twice

it would be pretty easy with the if function and so but

  • I'm not allowed to use conditionals or loops

edit: cant use arrays I've tried to divide numbers by each other to get a 0 which indicates one is bigger or smaller

Aucun commentaire:

Enregistrer un commentaire