In fact you can't do that at all with the integer variable alone. It stores the integral number as such, but no number formatting information whatsoever. (In fact, even though it's commonly output in decimal for easy reception by humans, the integer varable isn't even decimal.)

As I understand your assignment, it's asking you to convert the integer into a string in an appropriate way (as you already suggesed) and then print that. You're not even required to preserve the string holding the conversion result; you can simply discard it after printing. And, in particular, you're not required to put the formatted integer value back into the original integer variable, which would be impossible anyway, as pointed out above.