Sum of two numbers is 14 and their difference is 10. Find the product of the two numbers. code example
Example: Given an integer number n, return the difference between the product of its digits and the sum of its digits.
class Solution {
public int subtractProductAndSum(int n) {
int res=0;
int p=1;
int sum=0;
while(n!=0){
int r=n%10;
n=n/10;
p=p*r;
sum+=r;
}
res=p-sum;
return res;
}
}