Description
Given an integer number n, return the difference between the product of its digits and the sum of its digits. For example, for 234: (2*3*4) - (2+3+4) = 24 - 9 = 15.
Examples
Input:
n = 234Output:
15Explanation:
2*3*4 - (2+3+4) = 24-9 = 15.
Input:
n = 123Output:
-0Explanation:
Product of digits: 1 × 2 × 3 = 6. Sum of digits: 1 + 2 + 3 = 6. Result: 6 - 6 = 0
Input:
n = 4421Output:
23Explanation:
Product of digits: 4 × 4 × 2 × 1 = 32. Sum of digits: 4 + 4 + 2 + 1 = 11. Result: 32 - 11 = 21
Constraints
- •
1 ≤ n ≤ 10⁵