The riddle
How Many 9s Are There Between 1 and 100?
Counting digits, not numbers
Digits, not numbers, are what the question counts: the digit 9, and not the numbers that hold one. The ones place has a 9 in 9, 19, 29, 39, 49, 59, 69, 79, 89 and 99, which is ten of them. The tens place has a 9 in every number from 90 to 99, another ten. Together that is 20. The number 99 appears in both counts, because it holds two 9s.
A way to check
Write the numbers from 0 to 99 in ten rows of ten, starting each row at a multiple of ten. The last column holds ten ones-place 9s, and the last row holds ten tens-place 9s. The corner, 99, belongs to both lines. The number 100 has no 9, so the end of the range adds nothing. Another check works block by block: each block of ten from 0 to 99 has exactly one number ending in 9, so ten blocks give ten ones-place 9s.