The sum and product of two integers are 26 and 165 respectively. The difference between these two integer is ____ 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;
}
}