You should become a teacher, you have a great way of suggesting solutions without flat-out telling the answer. This counting function sounds exactly like an exercise I did while learning programming.
And be sure it can handle the number 0 (which still takes 1 character to print on-screen). It is an easy one to miss when you're focusing on testing bigger numbers.
Using standard library functions, depending on what you know about the input number type, a perhaps easier mathematical approach could be to use log10(i)+1 but it's still up to you to handle negatives, floats, etc..