How many strings of 5 digits have the property that the sum of their digits is 7?
(A) 66
(B) 330
(C) 495
(D) 99
Answer: (B)
Explanation: We have to make string which have sum = 7.There are:
2,2,1,1,1 = 5! / 2! * 3! = 10
2,2,2,1,0 = 5! / 3! = 20
3,1,1,1,1 = 5! / 4! = 5
3,2,1,1,0 = 5! / 2! = 60
3,2,2,0,0 = 5! / 2! * 2! = 30
3,3,1,0,0 = 5! / 2! * 2! = 30
4,2,1,0,0 = 5! / 2! = 60
4,3,0,0,0 = 5! / 3! = 20
4,1,1,1,0 = 5! / 3! = 20
5,1,1,0,0 = 5! / 2! * 2! = 30
5,2,0,0,0 = 5! / 3! = 20
6,1,0,0,0 = 5! / 3! = 20
7,0,0,0,0 = 5! / 4! = 5
total = 10 + 20 + 5 + 60 + 30 + 30 + 60 + 20 + 20 + 30 + 20 + 20 + 5 = 330.
So, option (B) is correct.
Alternative method –
Lets digits are a, b, c, d, and e. Therefore,
a + b + c + d + e = 7
Total number of combinations are (n-1+r)C(r) = (5-1+7)C7 = 11C7 = 11C4 = 330.
Quiz of this Question
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
06 Sep, 2018
Like Article
Save Article