Page 43 - Computer Science Class 11 Without Functions
P. 43
Decimal to Hexadecimal Conversion
To convert a whole decimal number to hexadecimal, we follow the steps below:
1. Divide the number by 16.
2. On dividing the number by 16, the possible remainders are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, which
are represented as 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F, respectively. Note the corresponding hexadecimal
equivalent.
3. Repeat steps 3a and 3b until the quotient becomes 0.
3a. Divide the quotient by 16.
3b. Again, on dividing the number by 16, the possible remainders are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, which are represented as 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F, respectively. Note the corresponding
hexadecimal equivalent.
4. Write the remainders in reverse order from the hexadecimal number.
Find hexadecimal equivalent of (32) , (65) , and (255) .
10
10
10
Example 5: Convert (639) to its equivalent hexadecimal number.
10
16 639 Remainder
16 39 F
16 2 7
0 2
(639) = (27F)
10 16
Hexadecimal to Decimal Conversion
The steps to convert a hexadecimal number to decimal are as follows:
1. Write the hexadecimal number.
2. Below each digit, write its place value, represented as a power of 16.
3. Multiply the face value of each digit with its place value.
4. Add all values obtained in step 3 to get the decimal number.
Let us now convert (27F) to its equivalent decimal number.
16
Example 6: Convert (27F) to decimal
16
Face Value 2 7 F
1
2
Place value 16 16 16 0
2
= 2 × 16 + 7 × 16 + F × 16 0
2
= 2 × 16 + 7 × 16 + 15 × 16 0
= 512 + 112 + 15
= 639
(27F) = (639)
16 10
Number Systems and Encoding Schemes 41

