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

Java > Logic-1 > sortaSum
prev  |  next  |  chance

Given 2 ints, a and b, return their sum. However, sums in the range 10..19 inclusive, are forbidden, so in that case just return 20.

sortaSum(3, 4) → 7
sortaSum(9, 4) → 20
sortaSum(10, 11) → 21

...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-1

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

Copyright Nick Parlante 2006-10 - privacy