#3622

Check Divisibility by Digit Sum and Product

pupil · 300 · lc easy +20 · 69.6% accepted · 52 likes · top 78%

Description

Given a positive integer n, compute its digit sum (sum of all its digits) and its digit product (product of all its digits).

Determine whether n is divisible by the combined total of these two values.

Return true if so; otherwise return false.

Code

1
2
3