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

 

soweigel@smsd.org ap-comp-sci > dividesSelfH
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. Hint: use % to get the rightmost digit, and / to discard the rightmost digit.


dividesSelfH(128) → true
dividesSelfH(77777) → true
dividesSelfH(120) → false

...Save, Compile, Run (ctrl-enter)

public boolean dividesSelfH(int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 250

Copyright Nick Parlante 2017 - privacy