Hey everyone,

So i'll come out and say it. This is a homework assignment I and didnt understand at all. The deadline has passed, and i could not figure this out, but the problem still bugs me.

THE PROBLEM:

So we get to input three card numbers (blackjack)

We get three variables , a, b ,c. Each holds a number from 2 - 10. Or a number say 1 , which can be treated as a 11 or a 1. Given those three integers, we have to print out the best hand i.e the addition of integers closest or equal to 21. If there is no way we can get 21 or less than 21 with our hand , we print a 0.

Sounds simple enough right? Well, not so much. The catch our brilliant instructor put in , is to do this problem without selection (so no ifs, whiles, for, etc) , no recursion, no external functions.

ATTEMPT:

Quite simple i tried using math by first adding the three integers and trying various combinations like mod 21, divide by 21 etc. I am completely bowled over by this problem

I would greatly appreciate any help in understanding this algorithm.

Thanks

HeirofRome