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

Java > Warmup-1 > lastDigit
prev  |  next  |  chance

Given two non-negative int values, return true if they have the same last digit, such as with 27 and 57. Note that the % "mod" operator computes remainders, so 17 % 10 is 7.

lastDigit(7, 17) → true
lastDigit(6, 17) → false
lastDigit(3, 113) → true

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

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

Copyright Nick Parlante 2006-10 - privacy