Page 46 - Computer Science Class 11 With Functions
P. 46
To understand why the above method works, let us examine the following computations:
(1DC) 16
2
1
0
= 16 × 1 + 16 × (13) + 16 × (12)
1
3
3
0
2
2
0
1
1
2
= (16) × 1 + 16 × (2 × 1 + 2 × 1 + 2 × 0 + 2 × 1) + (2 × 1 + 2 × 1 + 2 × 0 + 2 × 0)
0
0
2
4 2
1
1
2
3
3
4
= (2 ) × 1 +2 × (2 × 1 + 2 × 1 + 2 × 0 + 2 × 1) + (2 × 1 + 2 × 1 + 2 × 0 + 2 × 0)
3
4 2
2
4
4
4
0
1
3
2
0
1
4
= (2 ) × 1 + 2 × 2 × 1 +2 × 2 × 1 + 2 × 2 × 0 + 2 × 2 × 1 + 2 × 1 + 2 × 1 + 2 × 0 + 2 × 0
8
1
3
5
6
= 2 × 1 + 2 × 1 + 2 × 1 + 2 × 0 + 2 × 1 + 2 × 1 + 2 × 1 + 2 × 0 + 2 × 0
0
7
2
4
Thus, (1DC) = (111011100) 2
16
Find binary representation of (34) , (6D) and (12F) .
16
16
16
Octal to Hexadecimal Conversion
To convert an octal number to hexadecimal or vice versa, convert the number to an equivalent number in binary or
decimal and then to hexadecimal.
Example 11: Convert (347) to its equivalent hexadecimal number.
8
Step 1: Octal to Binary
3 4 7
↓ ↓ ↓
011 100 111
(347) = (11100111) 2
8
Step 2: Binary to hexadecimal
1 1 1 0 0 1 1 1
E 7
(11100111) = (E7)
2 16
Therefore (347) = (E7) 16
8
Alternatively, you may first convert the octal number to its decimal equivalent and then find the hexadecimal
representation of the decimal number.
Find hexadecimal representation of (34) , (15) and (50) .
8
8
8
Hexadecimal to Octal Conversion
First, convert the hexadecimal number to an equivalent binary number and then convert the binary number to an octal
number, as shown in example 12.
Example 12: Convert (E7) to its equivalent octal number.
16
Step 1: Hexadecimal to Binary
E 7
↓ ↓
1110 0111
Binary equivalent of (E7) is (11100111)
16 2
44 Touchpad Computer Science-XI

