388. Check Divisibility by Digit Sum and Product

EasyMath

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.

Examples

Input: 99

Output: true

Explanation: Digit sum 9 + 9 = 18, digit product 9 * 9 = 81, total 99. Since 99 % 99 == 0, return true.

Constraints

  • 1 <= n <= 10^6
Loading...

Run checks all cases above. Submit evaluates all test cases.