jump,b
Chat with our AI personalities
One way to accomplish this is to allow the printf statement to do the work for you. Example: printf("Decimal %d = hex %02x\n", number, number); Or you could use the windows calculator. Select the Dec radian, type your number in, then select Hex radian.
112 = 70 hex
in hex 12 is represented as c.
(159)decimal = (9F)HEX
Because - Hex is an exact multiple of binary - whereas decimal numbers need to be converted from base 10 to base 2.