A value of base greater than 10, such as base==12 gives results which are not readable. That's because the character output when base is greater than 10 but not equal to 16 is just m. It might be better to use 'A' + m - 10 for any value of base which is greater than 10.