In computer sciences during studying, programmers must know how to convert number for example from binary to decimal or hexadecimal and octal. It is in easy way we must know hexadecimal consists of 16 values, numbers and letters. Letters A, B, C , D, E, F , and 10 numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.You may want to know in hexadecimal we use 4 bits to represent one value, but in octal only 3 bits. Let's assume we have this binary string 110010011101, separate them as groups of bits as we said, 4 bits if we want hexadecimal and 3 if octal.

Note: In hexadecimal A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

hexadecimal 1100 1001 1101

Each group has numbers like 1, 2, 4, 8, 16, 32, 64, etc. from 1 and after 2 each number multiply by 2 as rule in base 2. Let's take a look at the binary string from the right to left.

8 4 2 1

1 1 0 1

Compute each value has ( 1 ) the truth value. We have 1 + 4, + 8 = 13. 13 = D in hexadecimal. So 1101 = D. The next 1001.

8 4 2 1

1 0 0 1

We have only 1 + 8 = 9, So 1001 = 9 in hexadecimal. The final 1100.

8 4 2 1

1 1 0 0 8 + 4 = 12 , which represents C in hexadecimal. Let's look at the whole example 1100 1001 1101 = C 9 D in hexadecimal.

8 4 2 1 | 8 4 2 1 | 8 4 2 1

1 1 0 0 1 0 0 1 1 1 0 1

C 9 D

In octal it is the same case, but we take only 3 bits. Let's take the same previous binary string 110010011101.

4 2 1 | 4 2 1 | 4 2 1 | 4 2 1

1 1 0 0 1 0 0 1 1 1 0 1 From left to right we have 4 + 2 = 6, in second value only 2, third 2 + 1 =

**3**, fourth 4 + 1 =**5**.The result is 6 2 3 5 in octal.

## 0 comments:

Post a Comment