# Conversion of Binary Number System into Octal Number System

Here, we are going to learn **how to convert from Binary Number System into Octal Number System?**

Submitted by Saurabh Gupta, on October 15, 2019

**Prerequisite:** Number systems

To **convert binary numbers into octal numbers**, we first have to understand the relationship between binary and octal numbers.

Octal Number | Binary Number |
---|---|

0 | 000 |

1 | 001 |

2 | 010 |

3 | 011 |

4 | 100 |

5 | 101 |

6 | 110 |

7 | 111 |

In octal number system, we have eight digits ranging from **0 to 7** which can be represented using **three-bit binary numbers** in **2 ^{3} = 8** ways, so starting from the least significant bit of the binary number, we group three successive bits of the binary number to get its equivalent octal number as seen from the table above.

In an **integral part**, the grouping of three bits is done from the right side to the left side whereas in the **fractional part** the grouping of three bits is done from left to right and then convert it to its equivalent octal symbol.

In the process of grouping three bits, one or two bits can be added to the left of the MSB in an integral part and/or to the right of the LSB bit of the fractional part of the binary number.

**Example 1: Convert (110011.011) _{2} to ( ? )_{8}**

Therefore, **(110011.011) _{2} = (63.3)_{8}**

**Example 2: Convert (110011011110.1011) _{2} to ( ? )_{8}**

Therefore, **(110011011110.1011) _{2} = (14676.54)_{8}**

**Note:** In the Example 2, to make a group of three bits, we have added two additional bits to the left of MSB in an integral part and two additional bits to the right of LSB in the fractional part.

TOP Interview Coding Problems/Challenges

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions

**Ad:**
Are you a blogger? Join our Blogging forum.