When given a pair of ints, I need my code to be able to return the int that is closest to 21 without going over [closed]
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . // blackjack(7,17) -> 17 // blackjack(21, 16) -> 21 // blackjack(19,23) -> 19 public int blackjack(int a, int b) { } After this I am really unsure of how to go about writing this code. 回答1: Hi use this code. if(a<=21 && b<=21){ return Math.max(a, b); } This is a easy problem, try