In case you still wanted to know, the printf statement can do what you want. You'd have to specify the precision ( I believe it is .#, that is, a period followed by a number). In the case of integers it will force the output to have a specific minimum number of digits and print leading zeros if necessary. I found that info on the following page: