FunctionRacerProblemsRace

Product Minus Sum of Digits

BeginnerMathPython, JavaScript, TypeScript, Java, C++

Multiply all the digits of n together, add all the digits of n together, and return the product minus the sum.

Example 1

n 234
returns 15

Product 24, sum 9, so 15.

Example 2

n 4421
returns 21

Product 32, sum 11, so 21.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems