Step 4. Because 4 is less than 16, place a 0 in the 16 position and subtract 0 (0 * 16).
Step 5. Because 4 is less than 8, place a 0 in the 8 position and subtract 0 (0 * 8).
Step 6. Because 4 is NOT less than 4, place
a 1 in the 4 position and subtract 1 (1 *
4).
Step 7. Because 0 is less than 2, place a 0 in the 2 position and subtract 0 (0 * 2).
Step 8. Because 0 is less than 1, place a 0 in the 1 position and subtract 0 (0 * 1).
Figure 6-4 Conversion of
Decimal 4 to Binary
Step
1
|
4
|
0
|
|
|
|
|
|
|
|
|
4
|
<
128
|
– 0
|
128
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Step
2
|
4
|
|
0
|
|
|
|
|
|
|
|
4
|
<
64
|
– 0
|
|
64
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Step
3
|
4
|
|
|
0
|
|
|
|
|
|
|
4
|
<
32
|
– 0
|
|
|
32
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Step
4
|
4
|
|
|
|
0
|
|
|
|
|
|
4
|
<
16
|
– 0
|
|
|
|
16
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Step
5
|
4
|
|
|
|
|
0
|
|
|
|
|
4
|
<
8
|
– 0
|
|
|
|
|
8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Step
6
|
4
|
|
|
|
|
|
1
|
|
|
|
4
NOT < 4
|
– 4
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Step
7
|
0
|
|
|
|
|
|
|
0
|
|
|
0
|
<
2
|
– 0
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
|
|
|
|
|
Step
8
|
0
|
|
|
|
|
|
|
|
0
|
|
0
|
<
1
|
– 0
|
|
|
|
|
|
|
|
1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
0
|
0
|
0
|
0
|
0
|
1
|
0
|
0
|
|
|
|
|
|
|
|
|
|
|
|
|
Answer: 4 = 00000100
|
|
|
|
The following describes the steps
of converting decimal 20, as shown in Figure 6-5:
|
|
|
|
Step
1.
|
Because 20 is
less than 128, place a 0 in the 128
position and subtract 0 (0 * 128).
|
|
How To
|
|
||
|
|
|
|
|
Step
2.
|
Because
20 is less than 64, place a 0 in the 64
position and subtract 0 (0 * 64).
|
|
|
Step
3.
|
Because 20 is less than 32, place
a 0 in the 32 position and subtract 0 (0 *
32).
|
|
|
Step
4.
|
Because 20 is
NOT less than 16, place a 1 in the 16
position and subtract 16 (1 * 16).
|
|
|
Step
5.
|
Because 4 is less than 8, place a 0 in the 8 position and subtract 0 (0 * 8).
|
|
|
Step
6.
|
Because 4 is NOT less than 4,
place a 1 in the 4 position and subtract 1
(1 * 4).
|
|
|
Step
7.
|
Because 0 is less than 2, place a 0 in the 2 position and subtract 0 (0 * 2).
|
|
|
Step
8.
|
Because 0 is less than 1, place a 0 in the 1 position and subtract 0 (0 * 1).
|
|
Tidak ada komentar:
Posting Komentar