CONVERSION
AVTE 316
How to convert decimal to any number system:
1. Divide the given decimal number by n, where n is
the base number to be converted to.
2. Get the remainder.
3. Read upwards.
I. Decimal to Binary
Ex.
1. 18810 to ___2
2. 93810 to ___2
3. 102310 to ___2
divisor Dec. rem
No.
2 188 0
1. 18810 to ___2 2 94 0
2 47 1
2 23 1
2 11 1
Answer: 2 5 1
101111002 2 2 0
2 1 1
0
divisor Dec. rem divisor Dec. rem
No. No.
2 938 0 2 3 1
2. 93810 to ___2 2 469 1 2 1 1
2 234 0 0
2 117 1
2 58 0
Answer:
2 29 1
11101010102
2 14 0
2 7 1
divisor Dec. rem divisor Dec. rem
No. No.
2 1023 1 2 3 1
3. 102310 to ___2 2 511 1 2 1 1
2 255 1 0
2 127 1
2 63 1
Answer:
2 31 1
11111111112
2 15 1
2 7 1
ALTERNATE METHOD:
1. Write down the code for Binary. (1, 2, 4, 8, etc.)
2. Starting from the biggest, determine if the code
is greater or less than the given number.
3. If the code is less than or equal to the number,
write 1. If not, place a zero.
4. Do some subtractions until the equivalent code is
revealed.
1. 18810 to ___2
128 64 32 16 8 4 2 1
1 0 1 1 1 1 0 0
188 - 128 = 60
60 - 32 = 28 Answer:
28 - 16 = 12
12 - 8 = 4
101111002
4-4=0
2. 93810 to ___2
512 256 128 64 32 16 8 4 2 1
1 1 1 0 1 0 1 0 1 0
938 - 512 = 426
426 - 256 = 170 Answer:
170 - 128 = 42
42 - 32 = 10
11101010102
10 - 8 = 2
2-2=0
3. 102310 to ___2
512 256 128 64 32 16 8 4 2 1
1 1 1 1 1 1 1 1 1 1
1023 - 512 = 511 31 - 16 = 15
511 - 256 = 255 15 - 8 = 7 Answer:
255 - 128 = 127 7-4=3
127 - 64 = 63 3-2=1
11111111112
63- 32 = 31 1-1=0
II. Decimal to Octal
Ex.
1. 29110 to ___8
2. 87210 to ___8
3. 113010 to ___8
divisor Dec. rem
No.
8 291 3
1. 29110 to ___8 8 36 4
8 4 4
Answer:
4438
divisor Dec. rem
No.
8 872 0
2. 87210 to ___8 8 109 5
8 13 5
8 1 1
0
Answer:
15508
divisor Dec. rem
No.
8 1250 2
3. 125010 to ___8 8 156 4
8 19 3
8 2 2
0
Answer:
23428
ALTERNATE METHOD:
1. Write down the code for Octal. (1, 8, 64, etc.)
2. Starting from the biggest, determine how many
times can the code be contained in the given.
3. Write down the answer and do some
subtractions until the equivalent code is revealed.
1. 29110 to ___8
64 8 1
4 4 3
64 x 4 = 256 1x3=3
291 - 256 = 35 3-3=0 Answer:
8 x 4 = 32
4438
35 - 32 = 3
2. 87210 to ___8
512 64 8 1
1 5 5 0
512 x 1 = 512 8 x 5 = 40
872 - 512 = 360 40 - 40 = 0 Answer:
64 x 5 = 320
15508
360 - 320 = 40
3. 125010 to ___8
512 64 8 1
2 3 4 2
512 x 2 = 1024 8 x 4 = 32
1250 - 1024 = 226 34 - 32 = 2 Answer:
64 x 3 = 192 1x2=2
23428
226 - 192 = 34 2-2=0
III. Decimal to Hexadecimal
Ex.
1. 34010 to ___16
2. 94210 to ___16
3. 122910 to ___16
divisor Dec. rem
No.
16 340 4
1. 34010 to ___16 16 21 5
16 1 1
Answer:
15416
divisor Dec. rem
No.
16 942 14 (E)
2. 94210 to ___16 16 58 10 (A)
16 3 3
Answer:
3AE16
divisor Dec. rem
No.
16 1229 13 (D)
3. 122910 to ___16 16 76 12 (C)
16 4 4
Answer:
4CD16
ALTERNATE METHOD:
1. Write down the code for Hexadecimal. (1, 16,
256, etc.)
2. Starting from the biggest, determine how many
times can the code be contained in the given.
3. Write down the answer and do some
subtractions until the equivalent code is revealed.
1. 34010 to ___16
256 16 1
1 5 4
256 x 1 = 256 1x4=4
340 - 256 = 84 4-4=0 Answer:
16 x 5 = 80
15416
84 - 80 = 4
2. 94210 to ___16
256 16 1
3 10 14
(A) (E)
256 x 3 = 768 1 x 14 = 14
942 - 768 = 174 14 - 14 = 0 Answer:
16 x 10 = 160
3AE16
174 - 160 = 14
3. 122910 to ___16
256 16 1
4 12 13
(C) (D)
256 x 4 = 1024 1 x 13 = 13
1229 - 1024 = 205 13 - 13 = 0 Answer:
16 x 12 = 192
4CD16
205 - 192 = 13
How to convert binary to any number system:
1. Remember the code 1, 2, 4, 8, etc.
2. Express first to decimal, then it is now possible to
convert to any number system.
that is, B to D to N, where N is any number system
IV. Binary to Decimal
Ex.
1. 110100112 to ___10
2. 10011001002 to ___10
3. 111111111112 to ___10
1. 110100112 to ___10
128 64 32 16 8 4 2 1
1 1 0 1 0 0 1 1
128 64 0 16 0 0 2 1
128 + 64 + 16 + 2 + 1 = 21110 Answer:
21110
2. 10011001002 to ___10
512 256 128 64 32 16 8 4 2 1
1 0 0 1 1 0 0 1 0 0
512 0 0 64 32 0 0 4 0 0
512 + 64 + 32 + 4 = 61210 Answer:
61210
3. 111111111112 to ___10
1024 512 256 128 64 32 16 8 4 2 1
1 1 1 1 1 1 1 1 1 1 1
1024 512 256 128 64 32 16 8 4 2 1
1024 + 512 + 256 + 128 + 64 + 32 Answer:
+ 16 + 8 + 4 + 2 + 1 = 204710
204710
V. Binary to Octal
Ex.
1. 101110012 to ___8
2. 10100111102 to ___8
3. 101011001012 to ___8
1. 101110012 to ___8
128 64 32 16 8 4 2 1
1 0 1 1 1 0 0 1
128 0 32 16 8 0 0 1
128 + 32 + 16 + 8 + 1 = 18510
divisor Dec. rem
No.
8 185 1
Then, convert: 8 23 7
18510 to ___8 8 2 2
Answer:
2718
2. 10100111102 to ___8
512 256 128 64 32 16 8 4 2 1
1 0 1 0 0 1 1 1 1 0
512 0 128 0 0 16 8 4 2 0
512 + 128 + 16 + 8 + 4 + 2 = 67010
divisor Dec. rem
No.
8 670 6
Then, convert: 8 83 3
67010 to ___8 8 10 2
8 1 1
0
Answer:
12368
3. 101011001012 to ___8
1024 512 256 128 64 32 16 8 4 2 1
1 0 1 0 1 1 0 0 1 0 1
1024 0 256 0 64 32 0 0 4 0 1
1024 + 256 + 64 + 32 + 4 + 1 = 138110
divisor Dec. rem
No.
8 1381 5
Then, convert: 8 172 4
138110 to ___8 8 21 5
8 2 2
0
Answer:
25458
ALTERNATE METHOD:
Take note: Binary to Octal, that is:
base 2 to base 8
Relating them: 2^n = 8
where n = 3
Magic number is 3
What to do?
1. Copy the binary number.
2. Starting from the right, divide the given into
groups with 3 members.
3. Decode using the binary code.
1. 101110012 to ___8
2 1 4 2 1 4 2 1
1 0 1 1 1 0 0 1
2 7 1
Answer:
2718
2. 10100111102 to ___8
1 4 2 1 4 2 1 4 2 1
1 0 1 0 0 1 1 1 1 0
1 2 3 6
Answer:
12368
3. 101011001012 to ___8
2 1 4 2 1 4 2 1 4 2 1
1 0 1 0 1 1 0 0 1 0 1
2 5 4 5
Answer:
25458
VI. Binary to Hexadecimal
Ex.
1. 101001012 to ___16
2. 10110100102 to ___16
3. 101101111012 to ___16
1. 101001012 to ___16
128 64 32 16 8 4 2 1
1 0 1 0 0 1 0 1
128 0 32 0 0 4 0 1
128 + 32 + 4 + 1 = 16510
divisor Dec. rem
No.
16 165 5
Then, convert: 16 10 10 (A)
16510 to ___16 0
Answer:
A516
2. 10110100102 to ___16
512 256 128 64 32 16 8 4 2 1
1 0 1 1 0 1 0 0 1 0
512 0 128 64 0 16 0 0 2 0
512 + 128 + 64 + 16 + 2 = 72210
divisor Dec. rem
No.
16 722 2
Then, convert: 16 45 13 (D)
72210 to ___16 16 2 2
Answer:
2D216
3. 101101111012 to ___16
1024 512 256 128 64 32 16 8 4 2 1
1 0 1 1 0 1 1 1 1 0 1
1024 0 256 128 0 32 16 8 4 0 1
1024 + 256 + 128 + 32 + 16 + 8 + 4 + 1 = 146910
divisor Dec. rem
No.
16 1469 13 (D)
Then, convert: 16 91 11 (B)
146910 to ___16 16 5 5
Answer:
5BD16
ALTERNATE METHOD:
Take note: Binary to Hexadecimal, that is:
base 2 to base 16
Relating them: 2^n = 16
where n = 4
Magic number is 4
What to do?
1. Copy the binary number.
2. Starting from the right, divide the given into
groups with 4 members.
3. Decode using the binary code.
1. 101001012 to ___16
8 4 2 1 8 4 2 1
1 0 1 0 0 1 0 1
10 (A) 5
Answer:
A516
2. 10110100102 to ___16
2 1 8 4 2 1 8 4 2 1
1 0 1 1 0 1 0 0 1 0
2 13 (D) 2
Answer:
2D216
3. 101101111012 to ___16
4 2 1 8 4 2 1 8 4 2 1
1 0 1 1 0 1 1 1 1 0 1
5 11 (B) 13 (D)
Answer:
5BD16
How to convert octal to any number system:
1. Remember the code 1, 8, 64, 512, etc.
2. Express first to decimal, then it is now possible to
convert to any number system.
that is, O to D to N, where N is any number system
VII. Octal to Decimal
Ex.
1. 2578 to ___10
2. 10368 to ___10
3. 21358 to ___10
1. 2578 to ___10
64 8 1
2 5 7
128 40 7
128 + 40 + 7 = 17510 Answer:
17510
2. 10368 to ___10
512 64 8 1
1 0 3 6
512 0 24 6
512 + 24 + 6 = 54210 Answer:
54210
3. 21358 to ___10
512 64 8 1
2 1 3 5
1024 64 24 5
1024 + 64 + 24 + 5 = 111710 Answer:
111710
VIII. Octal to Binary
Ex.
1. 4518 to ___2
2. 21438 to ___2
3. 25388 to ___2
1. 4518 to ___2
64 8 1
4 5 1
256 40 1
256 + 40 + 1 = 29710
divisor Dec. rem divisor Dec. rem
No. No.
2 297 1 2 2 0
2 148 0 2 1 1
Then, convert:
2 74 0 0
29710 to ___2
2 37 1
2 18 0
Answer: 2 9 1
1001010012 2 4 0
2. 21438 to ___2
512 64 8 1
2 1 4 3
1024 64 32 3
1024 + 64 + 32 + 3 = 112310
divisor Dec. rem divisor Dec. rem
No. No.
2 1123 1 2 8 0
2 561 1 2 4 0
Then, convert:
2 280 0 2 2 0
112310 to ___2
2 140 0 2 1 1
2 70 0 0
Answer: 2 35 1
100011000112 2 17 1
3. 25788 to ___2
No 8 in octal
INVALID!!!
ALTERNATE METHOD:
Take note: Octal to Binary, that is:
base 8 to base 2
Relating them: 8 = 2^n
where n = 3
Magic number is 3
What to do?
1. Copy the octal number.
2. Express each octal number with its equivalent
binary number.
3. Combine all the codes.
1. 4518 to ___2
4 2 1 4 2 1 4 2 1
1 0 0 1 0 1 0 0 1
4 5 1
Answer:
1001010012
2. 21438 to ___2
2 1 4 2 1 4 2 1 4 2 1
1 0 0 0 1 1 0 0 0 1 1
2 1 4 3
Answer:
100011000112
3. 25788 to ___2
2 1 4 2 1 4 2 1 4 2 1
1 0 1 0 1 1 1 1 ? ? ?
2 5 7 8
Answer:
INVALID!!!
IX. Octal to Hexadecimal
Ex.
1. 5608 to ___16
2. 14368 to ___16
3. 23548 to ___16
1. 5608 to ___16
64 8 1
5 6 0
320 48 0
320 + 48 = 36810
divisor Dec. rem
No.
16 368 0
Then, convert: 16 23 7
36810 to ___16 16 1 1
Answer:
17016
2. 14368 to ___16
512 64 8 1
1 4 3 6
512 256 24 6
512 + 256 + 24 + 6 = 79810
divisor Dec. rem
No.
16 798 14 (E)
Then, convert: 16 49 1
79810 to ___16 16 3 3
Answer:
31E16
3. 23548 to ___16
512 64 8 1
2 3 5 4
1024 192 40 4
1024 + 192 + 40 + 4 = 126010
divisor Dec. rem
No.
16 1260 12 (C)
Then, convert: 16 78 14 (E)
126010 to ___16 16 4 4
Answer:
4EC16
ALTERNATE METHOD:
Take note: Octal to Hexadecimal, that is:
base 8 to base 16
Relating them:
from 3 to 4
Magic numbers are 3 and 4
What to do?
1. Copy the octal number.
2. Express each octal number with its equivalent 3
bit binary number.
3. Starting from the right, divide the binary number
into groups with 4 members.
4. Decode using the binary code.
1. 5608 to ___16
4 2 1 4 2 1 4 2 1
1 0 1 1 1 0 0 0 0
5 6 0
1 8 4 2 1 8 4 2 1
1 0 1 1 1 0 0 0 0
1 7 0
Answer:
17016
2. 14368 to ___16
1 4 2 1 4 2 1 4 2 1
1 1 0 0 0 1 1 1 1 0
1 4 3 6
2 1 8 4 2 1 8 4 2 1
1 1 0 0 0 1 1 1 1 0
3 1 14 (E)
Answer:
31E16
3. 23548 to ___16
2 1 4 2 1 4 2 1 4 2 1
1 0 0 1 1 1 0 1 1 0 0
2 3 5 4
4 2 1 8 4 2 1 8 4 2 1
1 0 0 1 1 1 0 1 1 0 0
4 14 (E) 12 (C)
Answer:
4EC16
How to convert hexadecimal to any number
system:
1. Remember the code 1, 16, 256, 4096 etc.
2. Express first to decimal, then it is now possible to
convert to any number system.
that is, H to D to N, where N is any number system
X. Hexadecimal to Decimal
Ex.
1. 19816 to ___10
2. 2B716 to ___10
3. A9E16 to ___10
1. 19816 to ___10
256 16 1
1 9 8
256 144 8
256 + 144 + 8 = 40810 Answer:
40810
2. 2B716 to ___10
256 16 1
2 B (11) 7
512 176 7
512 + 176 + 7 = 69510 Answer:
69510
3. A9E16 to ___10
256 16 1
A (10) 9 E (14)
2560 144 14
2560 + 144 + 14 = 271810 Answer:
271810
XI. Hexadecimal to Binary
Ex.
1. 10516 to ___2
2. 3C816 to ___2
3. AD416 to ___2
1. 10516 to ___2
256 16 1
1 0 5
256 0 5
256 + 5 = 26110
divisor Dec. rem divisor Dec. rem
No. No.
2 261 1 2 2 0
2 130 0 2 1 1
Then, convert:
2 65 1 0
26110 to ___2
2 32 0
2 16 0
Answer: 2 8 0
1000001012 2 4 0
2. 3C816 to ___2
256 16 1
3 C (12) 8
768 192 8
768 + 192 + 8 = 96810
divisor Dec. rem divisor Dec. rem
No. No.
2 968 0 2 7 1
2 484 0 2 3 1
Then, convert:
2 242 0 2 1 1
96810 to ___2
2 121 1 0
2 60 0
Answer: 2 30 0
11110010002 2 15 1
3. AD416 to ___2
256 16 1
A (10) D (13) 4
2560 208 4
2560 + 208 + 4 = 277210
divisor Dec. rem divisor Dec. rem
No. No.
2 2772 0 2 21 1
2 1386 0 2 10 0
Then, convert:
2 693 1 2 5 1
277210 to ___2
2 346 0 2 2 0
2 173 1 2 1 1
Answer: 2 86 0 0
1010110101002 2 43 1
ALTERNATE METHOD:
Take note: Hexadecimal to Binary, that is:
base 16 to base 2
Relating them: 16 = 2^n
where n = 4
Magic number is 4
What to do?
1. Copy the hexadecimal number.
2. Express each hexadecimal number with its
equivalent binary number.
3. Combine all the codes.
1. 10516 to ___2
1 8 4 2 1 8 4 2 1
1 0 0 0 0 0 1 0 1
1 0 5
Answer:
1000001012
2. 3C816 to ___2
2 1 8 4 2 1 8 4 2 1
1 1 1 1 0 0 1 0 0 0
3 C (12) 8
Answer:
11110010002
3. AD416 to ___2
8 4 2 1 8 4 2 1 8 4 2 1
1 0 1 0 1 1 0 1 0 1 0 0
A (10) D (13) 4
Answer:
1010110101002
XII. Hexadecimal to Octal
Ex.
1. 2B016 to ___8
2. 45916 to ___8
3. 81F16 to ___8
1. 2B016 to ___8
256 16 1
2 B (11) 0
512 176 0
512 + 176 = 68810
divisor Dec. rem
No.
8 688 0
Then, convert: 8 86 6
68810 to ___8 8 10 2
8 1 1
0
Answer:
12608
2. 45916 to ___8
256 16 1
4 5 9
1024 80 9
1024 + 80 + 9 = 111310
divisor Dec. rem
No.
8 1113 1
Then, convert: 8 139 3
111310 to ___8 8 17 1
8 2 2
0
Answer:
21318
3. 81F16 to ___8
256 16 1
8 1 F (15)
2048 16 15
2048 + 16 + 15 = 207910
divisor Dec. rem
No.
8 2079 7
Then, convert: 8 259 3
207910 to ___8 8 32 0
8 4 4
0
Answer:
40378
ALTERNATE METHOD:
Take note: Hexadecimal to Octal, that is:
base 16 to base 8
Relating them:
from 4 to 3
Magic numbers are 3 and 4
What to do?
1. Copy the hexadecimal number.
2. Express each hexadecimal number with its
equivalent 4 bit binary number.
3. Starting from the right, divide the binary number
into groups with 3 members.
4. Decode using the binary code.
1. 2B016 to ___8
2 1 8 4 2 1 8 4 2 1
1 0 1 0 1 1 0 0 0 0
2 B (11) 0
1 4 2 1 4 2 1 4 2 1
1 0 1 0 1 1 0 0 0 0
1 2 6 0
Answer:
12608
2. 45916 to ___8
4 2 1 8 4 2 1 8 4 2 1
1 0 0 0 1 0 1 1 0 0 1
4 5 9
2 1 4 2 1 4 2 1 4 2 1
1 0 0 0 1 0 1 1 0 0 1
2 1 3 1
Answer:
21318
3. 81F16 to ___8
8 4 2 1 8 4 2 1 8 4 2 1
1 0 0 0 0 0 0 1 1 1 1 1
8 1 F (15)
4 2 1 4 2 1 4 2 1 4 2 1
1 0 0 0 0 0 0 1 1 1 1 1
4 0 3 7
Answer:
40378