#3622
Check Divisibility by Digit Sum and Product
easy · 69.6% accepted · 52 likes · top 78%
Description
You are given a positive integer n. Determine whether n is divisible by the sum of the following two values:
-
The digit sum of n (the sum of its digits).
-
The digit product of n (the product of its digits).
Return true if n is divisible by this sum; otherwise, return false.
Solution