Docsity

Decimal to Hexadecimal Conversion: An Example with 51966 and 0x0BC.6 - Prof. Edward Boswor, Study notes of Programming Languages

Toggle sidebar
bg1
Direct Conversion from Decimal to Hexadecimal
Consider the following division involving the decimal number 51966.
3247
16)51966
48
39
32
76
64
126
112
14
Note that this is just the first step in the conversion to hexadecimal.
We have just established that 51966 / 16 = 3247 remainder = 14
51966 / 16 = 3247 remainder = 14
3247 / 16 = 202 remainder = 15
202 / 16 = 12 remainder = 10
12 / 16 = 0 remainder = 12
In hexadecimal 12, 10, 15, 14 is C, A, F, E. The number is 0xCAFE.
pf3

Partial preview of the text

Download Decimal to Hexadecimal Conversion: An Example with 51966 and 0x0BC.6 - Prof. Edward Boswor and more Study notes Programming Languages in PDF only on Docsity!

Direct Conversion from Decimal to Hexadecimal Consider the following division involving the decimal number 51966. 3247

48 39 32 76 64 126 112 14 Note that this is just the first step in the conversion to hexadecimal. We have just established that 51966 / 16 = 3247 remainder = 14 51966 / 16 = 3247 remainder = 14 3247 / 16 = 202 remainder = 15 202 / 16 = 12 remainder = 10 12 / 16 = 0 remainder = 12 In hexadecimal 12, 10, 15, 14 is C, A, F, E. The number is 0xCAFE.

Recall that A = 1010 10 B = 1011 11 C = 1100 12 D = 1101 13 E = 1110 14 F = 1111 15 Given the hexadecimal number 0x0BC. a) Convert this to binary. 0000 1011 1100. 0110 b) Convert this number, 0x0BC.6, to decimal. B = 11 and C =12. 11*16 + 12 = 188 6 / 16 = 3 / 8 = 0.375 188.