In: Computer Science
Convert the following binary values to hexadecimal and decimal (1 pt each)
Write Hex Numbers as 0x##(ex 0x0A, 0xFF)
|
Binary |
Hexadecimal |
Decimal |
|
0001-1011 |
0x |
|
|
0000-1000 |
||
|
0000-0100 |
||
|
0000-1001 |
||
|
0001-1111 |
||
|
1001-1001 |
||
|
0111-1010 |
||
|
1100-0010 |
||
|
1110-0101 |
||
|
1000-1010 |
||
|
0011-0100 |
||
|
0001-1001 |
||
|
0100-0011 |
||
|
1111-1111 |
||
|
1110-0111 |
||
|
0001-0010 |
||
|
0100-1000 |
||
|
0100-1110 |
||
|
1001-0001 |
||
|
0110-1100 |
Name:
Convert the following hexadecimal values to binary and decimal
Write binary numbers as 0000-0000
|
Hexadecimal |
Binary |
Decimal |
|
0xf1 |
||
|
0xac |
||
|
0x56 |
||
|
0x6c |
||
|
0x32 |
||
|
0x30 |
||
|
0x05 |
||
|
0x28 |
||
|
0xf0 |
||
|
0x07 |
||
|
0x42 |
||
|
0xb9 |
||
|
0x6d |
||
|
0x2f |
||
|
0x71 |
||
|
0x0e |
||
|
0x2d |
||
|
0xfb |
||
|
0xba |
||
|
0x3a |
Here is hexadecimal equivalent of 4-bit binary:-
0000 - 0 , 0001 - 1 , 0010 - 2 , 0011 - 3 , 0100 - 4 , 0101 - 5 , 0110 - 6 , 0111 - 7 , 1000 - 8 , 1001 - 9 , 1010 - A , 1011 - B , 1100 - C , 1101 - D , 1110 - E , 1111 - F
now , how to calculate the decimal equivalent of any binary number
suppose binary number = 00011011
then 00011011 = 1 x 20 + 1 x 21 + 0 x 22 + 1x23 + 1x24 + 0x25 + 0x26 + 0x27 = 27
Here , 2bit position i x bit number at position i (least significant bit has position number = 0 , and highest = 7)
|
Binary |
Hexadecimal |
Decimal |
|
0001-1011 |
0x1B |
27 |
|
0000-1000 |
0x08 | 8 |
|
0000-0100 |
0x04 | 4 |
|
0000-1001 |
0x09 | 9 |
|
0001-1111 |
0x1F | 31 |
|
1001-1001 |
0x99 | 153 |
|
0111-1010 |
0x7A | 122 |
|
1100-0010 |
0xC2 | 194 |
|
1110-0101 |
0xE5 | 229 |
|
1000-1010 |
0x8A | 138 |
|
0011-0100 |
0x34 | 52 |
|
0001-1001 |
0x19 | 25 |
|
0100-0011 |
0x43 | 67 |
|
1111-1111 |
0xFF | 255 |
|
1110-0111 |
0xE7 | 231 |
|
0001-0010 |
0x12 | 18 |
|
0100-1000 |
0x48 | 72 |
|
0100-1110 |
0x4E | 78 |
|
1001-0001 |
0x91 | 145 |
|
0110-1100 |
0x6C | 108 |
now , how to convert hexadecimal number into decimal.
suppose number 0xAB then A corresponds to decimal number 10 , B = 11 , C = 12 , D = 13 , E = 14 , F = 15
so , 0xAB = B x 160 + A x 161 = 11 x 1 + 10 x 16 = 11 + 160 = 171
|
Hexadecimal |
Binary |
Decimal |
|
0xf1 |
1111-0001 | 241 |
|
0xac |
1010-1100 | 172 |
|
0x56 |
0101-0110 | 86 |
|
0x6c |
0110-1100 | 108 |
|
0x32 |
0011-0010 | 50 |
|
0x30 |
0011-0000 | 48 |
|
0x05 |
0000-0101 | 5 |
|
0x28 |
0010-1000 | 40 |
|
0xf0 |
1111-0000 | 240 |
|
0x07 |
0000-0111 | 7 |
|
0x42 |
0100-0010 | 66 |
|
0xb9 |
1011-1001 | 185 |
|
0x6d |
0110-1101 | 109 |
|
0x2f |
0010-1111 | 47 |
|
0x71 |
0111-0001 | 113 |
|
0x0e |
0000-1110 | 14 |
|
0x2d |
0010-1101 | 45 |
|
0xfb |
1111-1011 | 251 |
|
0xba |
1011-1010 | 186 |
|
0x3a |
0011-1010 | 58 |