BlackJack II


Collapse Content

You're writing a program to play a variety of BlackJack. In general, given two numbers, a and b, return their sum.

If the sum is greater than 21, return 0, unless one of the numbers is 11. In such a case, the 11 should be 'converted' to a 1 to prevent the sum from being exceeded.

For example, given a 11 and 13 as input, the 11 should be 'converted' into a 1 so the total sum will be 14.

(See additional input/output below.)

ace-of-spades

image from wikipedia

Challenge

Return the sum of two blackjack 'cards', as above.

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Comments

Contact Us
Sign in or email us at [email protected]