id/email
password
forgot password
about | help | done | prefs | create account
JavaBat java practice problems

AP-1 > dividesSelf
prev  |  next  |  chance

We'll say that a positive int divides itself if every digit in the number divides into the number evenly. So for example 128 divides itself since 1, 2, and 8 all divide into 128 evenly. We'll say that 0 does not divide into anything evenly, so no number with a 0 digit divides itself. Note: use % to get the rightmost digit, and / to discard the rightmost digit.

dividesSelf(128) → true
dividesSelf(12) → true
dividesSelf(120) → false

...Save, Compile, Run

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


prev  |  next  |  chance   |  JavaBat  >  AP-1

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

Copyright Nick Parlante 2006-09 - privacy