How many strings of 5 digits have the property that the sum of their digits is…

2015

How many strings of 5 digits have the property that the sum of their digits is 7 ?

  1. A.

    66

  2. B.

    330

  3. C.

    495

  4. D.

    99

Attempted by 31 students.

Show answer & explanation

Correct answer: B

Key idea: Count the number of 5-tuples of digits (each 0–9) whose sum is 7.

Step 1: Translate to an equation.

  • Let x1,...,x5 be the five digits. We need nonnegative integer solutions to x1 + x2 + x3 + x4 + x5 = 7 with 0 ≤ xi ≤ 9.

  • Because the total 7 is less than 10, no single digit can exceed 9, so the upper bound xi ≤ 9 does not exclude any solutions.

Step 2: Apply stars and bars.

  • The number of nonnegative integer solutions to x1+...+x5=7 is C(7+5-1,5-1) = C(11,4).

  • Compute C(11,4) = 330.

Conclusion: There are 330 five-digit strings whose digits sum to 7. (Leading zeros are allowed because these are digit strings.)

Explore the full course: Tpsc Assistant Technical Officer