Computer Fundamental
Computer Fundamental
Methods
• Divide decimal number by 2.
• Repeat this method until quotient is less than 2.
• Bottom to top sequence of remainders will be the required binary
number.
Ex (1): (164)10 to (?)2
Let x be the required binary number.
(164)10 = (x)2
8 4 4
0
Computer Science Faculty_Kateb University 8
Converting Decimal Number Into Hexadecimal Number
• Divide decimal number by 16.
• Repeat this method until quotient is less than 16.
• Bottom to top sequence of reminders will be the required hexadecimal
number. 16 26295 7
16 1643 11
16 102 6
16 6 6
0
47068 = 4 x 83 + 7 x 82 + 0 x 81 + 6 x 80
values correspondin
= 4 x 512 + 7 x 64 + 0 + 6 x 1 g digits by the
multiplied
= 2048 + 448 + 0 + 6 Sum of these
products
= 250210
Note that the last remainder thus obtained will be the most
significant digit (MSD) of the new base number
digit 0012 = 0 x 22 + 0 x 21 + 1 x 20
=1
1012 = 1 x 22 + 0 x 21 + 1 x 20 = 5
0102 = 0 x 22 + 1 x 21 + 0 x 20 = 2
Example
5628 = ?2
Example
1111012 = ?16
0011 1101
Example
2AB16 = ?2
Step 2: Combine the binary groups
Step 1: Convert each hexadecimal digit
to a 4 digit binary number 2AB16 = 0010 1010 1011
2 A B
= 00102
216 = 210
A16 = 1010 = 10102
Hence, 2AB16 = 0010101010112
B16 = 1110 = 10112
Position 4 3 2 1 0 -2 -3 -4
. -1
Quantity 16 8 4 2 1 1/ 1/ 1/ 1/
2 4 8 16
Represente
d
Example
Position 3 2 1 0 . -1 -2 -3
Quantity 512 64 8 1 1/ 1/ 1/
8 64 512
Represente
d
Example
127.548 = 1 x 82 + 2 x 81 + 7 x 80 + 5 x 8-1 + 4 x
8-2
= 64 + 16 + 7 + 5/8 + 4/64
= 87 + 0.625 + 0.0625
= 87.687510