2AC 16 = 2 × 16 2 + 10 × 16 1 + 12 × 16 0
Similarly, hexadecimal number 3FFE 16can be shown as:
3FFE 16 = 3 × 16 3 + 15 × 16 2 + 15 × 16 1 + 14 × 16 0
1.6 Converting Binary Numbers into Decimal
To convert a binary number into decimal, write the number as the sum of the powers of 2.
Example 1.1
Convert binary number 1011 2into decimal.
Solution 1.1
Write the number as the sum of the powers of 2:
1011 2 = 1 × 2 3 + 0 × 2 2 + 1 × 2 1 + 1 × 2 0
= 8 + 0 + 2 = 1
= 11
or, 1011 2 = 11 10
Example 1.2
Convert binary number 11001110 2into decimal.
Solution 1.2
Write the number as the sum of the powers of 2:
11001110 2 = 1 × 2 7 + 1 × 2 6 + 0 × 2 5 + 0 × 2 4 + 1 × 2 3 + 1 × 2 2 + 1 × 2 1 + 0 × 2 0
= 128 + 64 + 0 + 0 + 8 + 4 + 2 + 0
= 206
or, 11001110 2 = 206 10
Table 1.1 shows the decimal equivalent of numbers from 0 to 31.
Table 1.1: Decimal equivalent of binary numbers
Binary |
Decimal |
Binary |
Decimal |
00000000 |
0 |
00010000 |
16 |
00000001 |
1 |
00010001 |
17 |
00000010 |
2 |
00010010 |
18 |
00000011 |
3 |
00010011 |
19 |
00000100 |
4 |
00010100 |
20 |
00000101 |
5 |
00010101 |
21 |
00000110 |
6 |
00010110 |
22 |
00000111 |
7 |
00010111 |
23 |
00001000 |
8 |
00011000 |
24 |
00001001 |
9 |
00011001 |
25 |
00001010 |
10 |
00011010 |
26 |
00001011 |
11 |
00011011 |
27 |
00001100 |
12 |
00011100 |
28 |
00001101 |
13 |
00011101 |
29 |
00001110 |
14 |
00011110 |
30 |
00001111 |
15 |
00011111 |
31 |
1.7 Converting Decimal Numbers into Binary
To convert a decimal number into binary, divide the number repeatedly by 2 and take the remainders. The first remainder is the least significant digit (LSD), and the last remainder is the most significant digit (MSD).
Example 1.3
Convert decimal number 28 10into binary.
Solution 1.3
Divide the number into 2 repeatedly and take the remainders:
28/2 → 14 Remainder 0 (LSD)
14/2 → 7 Remainder 0
7/2 → 3 Remainder 1
3/2 → 1 Remainder 1
1/2 → 0 Remainder 1 (MSD)
The binary number is 11100 2.
Example 1.4
Convert decimal number 65 10into binary.
Solution 1.4
Divide the number into 2 repeatedly and take the remainders:
65/2 → 32 Remainder 1 (LSD)
32/2 → 16 Remainder 0
16/2 → 8 Remainder 0
8/2 → 4 Remainder 0
4/2 → 2 Remainder 0
2/2 → 1 Remainder 0
1/2 → 0 Remainder 1 (MSD)
The binary number is 1000001 2.
Example 1.5
Convert decimal number 122 10into binary.
Solution 1.5
Divide the number into 2 repeatedly and take the remainders:
122/2 → 61 Remainder 0 (LSD)
61/2 → 30 Remainder 1
30/2 → 15 Remainder 0
15/2 → 7 Remainder 1
7/2 → 3 Remainder 1
3/2 → 1 Remainder 1
1/2 → 0 Remainder 1 (MSD)
The binary number is 1111010 2.
1.8 Converting Binary Numbers into Hexadecimal
To convert a binary number into hexadecimal, arrange the number in groups of four and find the hexadecimal equivalent of each group. If the number cannot be divided exactly into groups of four, insert zeros to the left of the number as needed so the number of digits are divisible by four.
Example 1.6
Convert binary number 10011111 2into hexadecimal.
Solution 1.6
First, divide the number into groups of four, then find the hexadecimal equivalent of each group:
10011111 = 1001 1111
9 F
The hexadecimal number is 9F 16.
Example 1.7
Convert binary number 1110111100001110 2into hexadecimal.
Solution 1.7
First, divide the number into groups of four, then find the hexadecimal equivalent of each group:
1110111100001110 = 1110 1111 0000 1110
E F 0 E
The hexadecimal number is EF0E 16.
Example 1.8
Convert binary number 111110 2into hexadecimal.
Solution 1.8
Since the number cannot be divided exactly into groups of four, we have to insert, in this case, two zeros to the left of the number so the number of digits is divisible by four:
111110 = 0011 1110
3 E
The hexadecimal number is 3E 16.
Table 1.2 shows the hexadecimal equivalent of numbers 0 to 31.
Table 1.2: Hexadecimal equivalent of decimal numbers
Decimal |
Hexadecimal |
Decimal |
Hexadecimal |
0 |
0 |
16 |
10 |
1 |
1 |
17 |
11 |
2 |
2 |
18 |
12 |
3 |
3 |
19 |
13 |
4 |
4 |
20 |
14 |
5 |
5 |
21 |
15 |
6 |
6 |
22 |
16 |
7 |
7 |
23 |
17 |
8 |
8 |
24 |
18 |
9 |
9 |
25 |
19 |
10 |
A |
26 |
1A |
11 |
B |
27 |
1B |
12 |
C |
28 |
1C |
13 |
D |
29 |
1D |
14 |
E |
30 |
1E |
15 |
F |
31 |
1F |
1.9 Converting Hexadecimal Numbers into Binary
To convert a hexadecimal number into binary, write the 4-bit binary equivalent of each hexadecimal digit.
Example 1.9
Convert hexadecimal number A9 16into binary.
Solution 1.9
Writing the binary equivalent of each hexadecimal digit:
A = 1010 29 = 1001 2
The binary number is 10101001 2.
Example 1.10
Convert hexadecimal number FE3C 16into binary.
Solution 1.10
Writing the binary equivalent of each hexadecimal digit:
F = 1111 2E = 1110 23 = 0011 2C = 1100 2
The binary number is 1111111000111100 2.
1.10 Converting Hexadecimal Numbers into Decimal
To convert a hexadecimal number into decimal, calculate the sum of the powers of 16 of the number.
Example 1.11
Convert hexadecimal number 2AC 16into decimal.
Solution 1.11
Calculating the sum of the powers of 16 of the number:
2AC 16 = 2 × 16 2 + 10 × 16 1 + 12 × 16 0
= 512 + 160 + 12
= 684
The required decimal number is 684 10.
Example 1.12
Convert hexadecimal number EE 16into decimal.
Solution 1.12
Calculating the sum of the powers of 16 of the number:
Читать дальше