what exactly is the question ? ...
that's a hard coded way of doing things ... what if you don't know
the size of the integer you're given ? ... 
think of the hint I just gave you, and how you can convert numbers
like 1500, 15, etc, into arrays of single digits ... 
good luck and have fun ! ...