其他分享
首页 > 其他分享> > 1281. Subtract the Product and Sum of Digits of an Integer

1281. Subtract the Product and Sum of Digits of an Integer

作者:互联网

!!!题目地址!!!



int subtractProductAndSum(int n){
    int product = 1;
    int sum = 0;
    while(n != 0){
        product *= n%10;
        sum += n%10;
        n /= 10;
    }
    return product-sum;
}

标签:Digits,10,Product,1281,int,sum,product,n%
来源: https://www.cnblogs.com/realms/p/16283074.html