Here's what I would do: first, write a program that works only for the numbers 1 to 10. Test it, make sure it works for all values. Then extend it to work for values up to nineteen, and test it again. Then add support for 20-29, and test again.
Now you do something a little different, I think. Adding support for 30-39 is going to be more a generalization than an addition. When it works, test some more.
Then add support up to 99, and test some more.
Then add support for "100", and test some more.
Now add support up to 199, and test some more...
By breaking this into small, manageable problems, you'll have a much easier time of it.