Converting Decimal to Hexadecimal and Octal
问题 Show how to write a constant in C, whose decimal value is 65 as a. a hexadecimal constant 65/16 = 1 r1 1/16 = 0 r1 Hexadecimal constant = 11 b. an octal constant (in C) 65/8 = 8 r1 8/8 = 1 r0 1/8 = 0 r1 Octal constant = 101 Is this the right way to convert constants in C? 回答1: You just need a while loop and a string. As this is homework, I do not think I should say more than that. 回答2: The method is to divide by the base until the result is less than the base. So 65/8 gives 8 r1 but you don't