[Leetcode] 5279. Subtract the Product and Sum of Digits of an Integer
class Solution { public int subtractProductAndSum(int n) { int productResult = 1; int sumResult = 0; do { int currentval = n % 10; productResult *= currentval; sumResult += currentval; n /= 10; }while(n > 0); return productResult - sumResult; } }