Power of Two | Decimal Value |
210
29
28
27
26
25
24
23
22
21
20
2-1
2-2
2-3
2-4
2-5
26
|
1024
512
256
128
64
32
16
8
4
2
1
0.5
0.25
0.125
0.0625
0.03125
0.015625
|
|
Decimal Number |
Binary Number
16 8 4 2 1
|
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
0 0 0 0 0
0 0 0 0 1
0 0 0 1 0
0 0 0 1 1
0 0 1 0 0
0 0 1 0 1
0 0 1 1 0
0 0 1 1 1
0 1 0 0 0
0 1 0 0 1
0 1 0 1 0
0 1 0 1 1
0 1 1 0 0
0 1 1 0 1
0 1 1 1 0
0 1 1 1 1
1 0 0 0 0
1 0 0 0 1
1 0 0 1 0
1 0 0 1 1
1 0 1 0 0
|
|
Conversion to and from binary, decimal, octal, and hexidecimal are easy and very mechanical.
To convert into/from octal and hexidecimal you must first convert into binary. So this is
how we convers decimal to binary.
Example:
825 in decimal = ?????? in binary
825 / 2 = 412 R 1
412 / 2 = 206 R 0
206 / 2 = 103 R 0
103 / 2 = 51 R 1
51 / 2 = 25 R 1
25 / 2 = 12 R 1
12 / 2 = 6 R 0
6 / 2 = 3 R 0
3 / 2 = 1 R 1
1 / 2 = 0 R 1
= 1100111001 in binary
Simply we divide by 2 repeatedly and keep track of the remainders. Then we write out the
remainders in reverse order and we have our binary number. It is important to remember which
order your list of 0's and 1's is to be printed. THe easiest way I find to do this is to
remember that the pattern can be continued forever, that is 0/2 = 0 R 0 as such we
can end up with as many 0's as we want. And as we all know 0's at the start of a number
have no effect on the number's value.
|