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

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

Given 2 ints, a and b, return their sum. However, "teen" values in the range 13..19 inclusive, are extra lucky. So if either value is a teen, just return 19.

teenSum(3, 4) → 7
teenSum(10, 13) → 19
teenSum(13, 2) → 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-1

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

Copyright Nick Parlante 2006-10 - privacy