Ctrl K

Digits That Divide Evenly

Easy
You are given a positive integer number with no zeros among its digits. Count how many of its digits divide the number with no remainder. Each position counts on its own: if a qualifying digit appears several times, count it that many times.
Example 1
number=36 → 2

36 is divisible by both 3 and 6.

Example 2
number=255 → 2

255 is not divisible by 2 but is divisible by 5, which appears twice. The answer is 2.

Example 3
number=97 → 0

97 is prime, so neither 9 nor 7 divides it.

Constraints
  • 1 ≤ number ≤ 10⁹
  • number has no digit 0
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsA Number That Reads Both Ways EasyValue of a Roman Numeral EasyAdd One to a Digit Array EasySum of Binary Strings EasyWhole Square Root Easy
loading Python…
Input
number=36
Expected
2

Run checks the first 3 tests in your browser. Submit checks all 66 tests on the server, hidden ones included.