Выбрать главу

To convert a hexadecimal number into decimal, calculate the sum of the powers of 16 of the number.

Example 1.11

Convert hexadecimal number 2AC16 into decimal.

Solution 1.11

Calculating the sum of the powers of 16 of the number:

2AC16 = 2 × 162 + 10 × 161 + 12 × 160

      = 512 + 160 + 12

      = 684

The required decimal number is 68410.

Example 1.12

Convert hexadecimal number EE16 into decimal.

Solution 1.12

Calculating the sum of the powers of 16 of the number:

EE16 = 14 × 161 + 14 × 160

     = 224 + 14

     = 238

The decimal number is 23810.

1.11 Converting Decimal Numbers into Hexadecimal

To convert a decimal number into hexadecimal, divide the number repeatedly by 16 and take the remainders. The first remainder is the LSD, and the last remainder is the MSD.

Example 1.13

Convert decimal number 23810 into hexadecimal.

Solution 1.13

Dividing the number repeatedly by 16:

238/16 → 14 Remainder 14 (E) (LSD)

14/16  → 0  Remainder 14 (E) (MSD)

The hexadecimal number is EE16.

Example 1.14

Convert decimal number 68410 into hexadecimal.

Solution 1.14

Dividing the number repeatedly by 16:

684/16 → 42 Remainder 12 (C) (LSD)

42/16  → 2  Remainder 10 (A)

2/16   → 0  Remainder 2      (MSD)

The hexadecimal number is 2AC16.

1.12 Converting Octal Numbers into Decimal

To convert an octal number into decimal, calculate the sum of the powers of 8 of the number.

Example 1.15

Convert octal number 158 into decimal.

Solution 1.15

Calculating the sum of the powers of 8 of the number:

158 = 1 × 81 + 5 × 80

     = 8 + 5

     = 13

The decimal number is 1310.

Example 1.16

Convert octal number 2378 into decimal.

Solution 1.16

Calculating the sum of the powers of 8 of the number:

2378 = 2 × 82 + 3 × 81 + 7 × 80

     = 128 + 24 + 7

     = 159

The decimal number is 15910.

1.13 Converting Decimal Numbers into Octal

To convert a decimal number into octal, divide the number repeatedly by 8 and take the remainders. The first remainder is the LSD, and the last remainder is the MSD.

Example 1.17

Convert decimal number 15910 into octal.

Solution 1.17

Dividing the number repeatedly by 8:

159/8 → 19 Remainder 7 (LSD)

19/8  → 2  Remainder 3

2/8   → 0  Remainder 2 (MSD)

The octal number is 2378.

Example 1.18

Convert decimal number 46010 into octal.

Solution 1.18

Dividing the number repeatedly by 8:

460/8 → 57 Remainder 4 (LSD)

57/8  → 7  Remainder 1

7/8   → 0  Remainder 7 (MSD)

The octal number is 7148.

Table 1.3 shows the octal equivalent of decimal numbers 0 to 31.

Table 1.3: Octal equivalent of decimal numbers

Decimal Octal Decimal Octal
0 0 16 20
1 1 17 21
2 2 18 22
3 3 19 23
4 4 20 24
5 5 21 25
6 6 22 26
7 7 23 27
8 10 24 30
9 11 25 31
10 12 26 32
11 13 27 33
12 14 28 34
13 15 29 35
14 16 30 36
15 17 31 37

1.14 Converting Octal Numbers into Binary

To convert an octal number into binary, write the 3-bit binary equivalent of each octal digit.

Example 1.19