### Ticker

6/recent/ticker-posts

# L5, Hexadecimal System, Conversion of Hexadecimal number into Octal and vice versa, package q10856

Conversion of Hexadecimal number into Octal and vice versa :-

To convert a hex number to an octal, we will first convert the hex number to binary and then to octal.

Below are the detailed steps followed for the above mentioned process:

1. Convert each hex digit to its corresponding four binary digits (bits) from right to left.
2. Combine all the binary digits.
3. Separate the binary digits into groups of 3 bits each from right to left.
4. Ensure the left most group has 3 bits by prefixing necessary zeros.
5. Find the octal equivalent of each group and combine the resultant digits together.

For example, hexadecimal number 0x5AF6 is converted into binary as

```Hex Number    ->    5    A    F    6
Binary Number ->  0101 1010 1111 0110
Binary Number ->  0101101011110110
Binary Number ->   0 101 101 011 110 110
Binary Number ->  000 101 101 011 110 110 // After prefixing zeros in the left most group
Octal Number  ->   0   5   5   3   6   6
Octal Number  ->   055366
```

Hence, the octal equivalent of the given hexadecimal number is (55366)8

Similarly an octal can be converted into a hex following the below steps:

1. Convert each octal digit to its corresponding three binary digits (bits) from right to left.
2. Combine all the binary digits.
3. Separate the binary digits into groups of 4 bits each from right to left.
4. Ensure the left most group has 4 bits by prefixing necessary zeros.
5. Find the hex equivalent of each group and combine the resultant digits together.

For example, an octal number 0246 is converted into hexadecimal as

```Octal Number  ->   2   4   6
Binary Number ->  010 100 110
Binary Number ->  010100110
Binary Number ->     0 1010 0110
Binary Number ->  0000 1010 0110 // After prefixing zeros in the left most group
Hex Number    ->    0    A    6
Hex Number    ->   0X0A6
```

Hence, the hex equivalent of the given octal number is (A6)16

Select all the correct statements given below.
• (ABCD)16 is a hexadecimal number.
• Each hexadecimal digit is represented as four bit binary number.
• Octal number (157)8 is equivalent to the hexadecimal number (6F)16.
• Hexadecimal number (369)16 is equivalent of octal number (1561)8.