Cpe 11 - Activity 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Name: John Nathan C.

Badon Course and Year: BSCpE-I

Activity #2

Convert the following codes from Decimal to Octal or Hexadecimal and Vice Versa.

1) 156 Decimal to Octal

Step 1: Decimal to Binary

156
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 0)
78
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 0)
39
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
19
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
9
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
4
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 0)
2
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 0)
1
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)

15610 = 100111002

Step 2: Binary to Octal

100111002 -> 010 011 100

010 = 2
011 = 3
100 = 4

100111002 = 2348
2) 456,891 Decimal to Hexadecimal

Step 1: Decimal to Binary

456, 891
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
228,445
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
114,222
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 0)
57,111
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
28, 555
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
14,277
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
7,138
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 0)
3,569
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
1,784
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 0)
892
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 0)
446
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 0)
223
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
111
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
55
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
27
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
13
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
6
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 0)
3
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)
1
2
= (𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 1)

456, 89110 = 1101111100010111011


2

Step 2: Binary to Hexadecimal

0110 = 6
1111 = F
1000 = 8
1011 = B
1011 = B 11011111000101110112 = 6𝐹8𝐵𝐵16
3) 6,542 Octal to Decimal

Step 1: Octal to Binary

6 = 110
5 = 101
4 = 100
2 = 010

6, 5428 = 1101011000102

Step 2: Binary to Decimal

110101100010

0x2+1=1
1x2+1=3
3x2+0=6
6 x 2 + 1 = 13
13 x 2 + 0 = 26
26 x 2 + 1 = 53
53x 2 + 1 = 107
107 x 2 + 0 = 214
214 x 2 + 0 = 428
428 x 2 + 0 = 856
856 x 2 + 1 = 1,713
1749 x 2 + 0 = 3,426

1101011000102 = 3, 42610
4) BADFACE Hex to Decimal

Step 1: Hexadecimal to Binary

B = 1011
A = 1010
D = 1101
F = 1111
A = 1010
C = 1100
E = 1110

𝐵𝐴𝐷𝐹𝐴𝐶𝐸16 = 10111010110111111010110011102

Step 2: Binary to Decimal

1011101011011111101011001110

0x2+1=1
1x 2 + 0 = 2
2 x2 + 1 = 5
5 x 2 + 1 = 11
11 x 2 + 1 = 23
23 x 2 + 0 = 46
46 x 2 + 1 = 93
93 x 2+ 0 = 186
186 x 2 + 1 = 373
373 x 2 + 1 = 747
747 x 2 + 0 = 1,494
1494 x 2 + 1 = 2,989
2,989 x 2 + 1 = 5, 989
5,979 x 2 + 1 = 11,959
11,959 x 2 + 1 = 23,919
23,919 x 2 + 1 = 47,389
47,389 x 2 + 1 = 95,679
95,679 x 2 + 0 = 191, 358
191, 358 x 2 + 1 = 382,717
382,717 x 2 + 0 = 765,434
765,434 x 2 + 1 = 1,530,869
1,530,869 x 2 + 1 = 3,061,739
3,061,739 x 2 + 0 = 6,123,478
6,123,478 x 2 + 0 = 12,246,956
12,246,956 x 2 + 1 = 24,493,913
24,493,913 x 2 + 1 = 48,987,827
48,987,827 x 2 + 1 = 97,975,655
97,975,655 x 2 + 0 = 195,951,310

𝐵𝐴𝐷𝐹𝐴𝐶𝐸16 = 195, 951, 31010

Show your solution. What was the method or technique you use
to convert them?

Methods Used:

1. Decimal to Octal: Method 2 in Decimal to Binary Conversion (short division by two with
remainder)

2. Decimal to Hexadecimal: Method 2 in Decimal to Binary Conversion (short division by two


with remainder)

3. Octal to Decimal: Method 2 in Binary to Decimal Conversion (using doubling)

4. Hexadecimal to Decimal: Method 2 in Binary to Decimal Conversion (using doubling)

You might also like