How many 4-digit numbers, sum of whose digits is 6, are divisible by 12? This question was in chapter 'permutations and combinations' of my school math book. I was wondering if there is a solution not related to chapter.( By the way I don't know the solution even related to chapter) I would love to see any solution may or may not related to topic.
 A: A number that is divisible by $12$ is divisible by $3$ and by $4$.  The former is already guaranteed by the sum of the digits being equal to $6$.  The latter is true provided the last two digits make a number divisible by $4$.
Only a handful of two-digit numbers are divisible by $4$ and have a sum less than $6$: $00, 04, 12, 20, 32, 40$.  These leave a "residue" of digit sum that must be satisfied by the first two digits of the four-digit number: respectively, $6, 2, 3, 4, 1, 2$.  Since the first digit must be at least $1$, that same list gives the number of ways to obtain that residue.
Therefore, the total number of qualifying numbers is $6+2+3+4+1+2 = 18$.

Or, you can write code to enumerate all the qualifying numbers.  That works and is probably not in your chapter. :-)  It confirms the count of $18$.
A: To be divisible by 12, number should be divisible by 4 and 3. Number is divisible by 3 as sum of its digits is 6 which is divisible by 3. For it to be divisible by 4, last two digits of number should be divisible by 4. In this case, we have choices of last two digits as 00,04,12,20,32 and 40. In first case sum of first two digits should be 6, in second case it should be 2, in third case 3 and in fourth case 4, in fifth case 1 and in sixth case 2. Now task is remained to find two digit numbers whose sum is either 1,2,3,4 or 6 which are 1,2,3,4 and 6 respectively. Now multiply 2 by 2 because it appears twice and add them and you will get 18 as the required answer.
