Dsa
Math
Easy
Digit Product Sum
Given a positive integer N, your task is to compute the sum of the products of its digits. For each digit, multiply it by the sum of the remaining digits, and then sum these products together. For instance, for N = 123, the result would be 1*(2+3) + 2*(1+3) + 3*(1+2) = 1*5 + 2*4 + 3*3 = 5 + 8 + 9 = 22.
Input Format:
- A single integer N (1 <= N <= 10^6)
Output Format:
- A single integer representing the result.
Example:
Input:
123
Output:
22
Key concepts
mathdigits
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now