id/email
password
forgot password
about | help | done | prefs | create account
CodingBat code practice

Java > Logic-2 > blackjack
prev  |  next  |  chance

Given 2 int values greater than 0, return whichever value is nearest to 21 without going over. Return 0 if they both go over.

blackjack(19, 21) → 21
blackjack(21, 19) → 21
blackjack(19, 22) → 19

...Save, Compile, Run

See also Java Example Code. Java help docs: If Boolean Logic | Strings | While and For Loops | Arrays and Loops


prev  |  next  |  chance   |  CodingBat  >  Logic-2

Forget It! -- delete my code for this problem 218.0

Copyright Nick Parlante 2006-10 - privacy