Update appNew update is available. Click here to update.

Subtract The Product And Sum Of Digits Of An Integer

Last Updated: 17 Mar, 2021
Difficulty: Easy

PROBLEM STATEMENT

Try Problem

You are given an integer number ‘N’, and your task is to return the difference between the product of its digits and the sum of its digits.

Note:
You do not need to print anything; it has already been taken care of. Just implement the given function.
For Example :
Input: N = 234
Output: 15 
Explanation: 
Product of digits = 2 * 3 * 4 = 24 
Sum of digits = 2 + 3 + 4 = 9 
Result = 24 - 9 = 15
Input Format :
The first line of input contains a single integer ‘T’ denoting the number of test cases.

The second line contains the integer ‘N’ whose difference between the product and the sum of all the digits need to be calculated.
Output Format :
For each test case print the difference between the product and the sum of all the digits in ‘N’.
Note:
You do not need to print anything; it has already been taken care of. Just implement the given function.
Constraints :
1 <= T <= 3000
1 <= N <= 10^5

Time Limit: 1 sec