[Leetcode]
作者:互联网
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; } }
标签:10,do,int,currentval,sumResult,Leetcode,productResult 来源: https://www.cnblogs.com/seako/p/12005148.html