Digit Product Minus Sum
You can work with the digits of a number separately: add them, multiply them, and compare the results. Given an integer n, find the product of all its digits and the sum of all its digits. Return the difference: product minus sum.
Примеры
Ввод
234Вывод
15Ввод
4421Вывод
21Ввод
1Вывод
0Нужно реализовать
def subtract_product_and_sum(n: int) -> int:
Теги
math
Kirjaudu sisään nähdäksesi palautushistorian
Kirjaudu sisäänKirjaudu sisään käyttääksesi tekoälymentoria
Kirjaudu sisäänVisible tests
1
Input
234Expected
152
Input
4421Expected
213
Input
1Expected
04
Input
10Expected
-15
Input
99Expected
636
Input
0Expected
0Focus radio
Paused · SomaFM · Fluid