Power, p | 2P |
0 | 1 |
1 | 2 |
2 | 4 |
3 | 8 |
4 | 16 |
5 | 32 |
6 | 64 |
7 | 128 |
8 | 256 |
9 | 512 |
Fig 2 Some powers of 2
1- Write out powers of 2 in a line starting at the right with 1. That is write ... 64 32 16 8 4 2 1 (as many as necessary).
2- Subtract these powers of 2 from the number. Each time subtract the largest one which will go.
3- When a power is subtracted write a 1 under that power, otherwise write a 0.
Convert the decimal number 71 to binary.
64 32 16 8 4 2 1 (The line of powers)
1 0 0 0 1 1 1 (The Is and Os written down while subtracting)
71-
64
7-
4
3-
2
Answer: 7110= 10001112
CONVERSION OF BINARY INTEGERS TO DECIMAL
1- Write powers of 2 above the digits of the binary numbers. Start at the right-hand end. That is write ... 64 32 16 8 4 2 1 (as many as necessary).
2- Write down the powers of 2 which are above a 1 in the binary number. Add them up to obtain the answer.
Convert the binary number 1101101 to decimal.
64 32 16 8 4 2 1
1 1 0 1 1 0 1
Number = 64+32+8+4+ 1
=109
Answer: 11011012 = 10910
Labels: Computer