You don't have to use a do-while. However, you'd have to modify a few things. A do-while's advantage is that it's a guaranteed first run. So without that guarantee, what if your user enters a negative number for the year and/or the month? You'll have to do some extra error check and have the user go back and enter a valid year and/or month.