Sum of all the digits of a 3 digit number that is $S(n)$ shall be between 1 and 27.because $(S(n)) = 2 $ and $S(n)$ is between 1 and 27 so we have $(n) \in \{ 2,11,20\}$ Now the number of 2 digit numbers(with leading zero) sum = n is n+1 for n <=9
This is so because 1st digit can be 0 to n and 2nd digit can be The number of 1/2 digit numbers sum = n is 19-n for 9 < n < 19 is 19-n. This is so because the 1st digit can go from n -9 to 9 or 9-(n-9) +1 =19-n numbersOne digit number is allowed ( that is 2 digit number with leading zero) because we are considering the tens digit of the 3 digit number that can be zero.Now we shall use the above 2 do the countingThe 3 digit numbers that have sum 3 are 101,110,200 that is 3 numberslet us count the number of 3 digit that have a sum 111st digit is 1 so sum of other 2 digit 10 so number of numbers = 19-10 = 91st digit is 2 to 9 so sum of other 2 digit 9 down to 2 number of numbers = $10 + 9 + \cdots 3 = \frac{(10 + 3)*8}{2} = 52$So the number of numbers that have sum 11 is 9 + 52 = 61let us count the number of 3 digit that have a sum 201st digit can be from 2 to 9 and that shall give the sum of other 2 digits of the number can be from 18 down to 11. the number of numbers can be 19-k with k from 18 to 11so the sum = $1+2 + \cdots 8 = \frac{8 * 9}{2} = 36$So total number of numbers with sum 20 = 36So total number of numbers = 3 + 61+ 36 = 100