Octal to Binary Conversion in dld digital logic design

Octal to Binary Conversion

C++ program to convert an octal number into binary

  • Each digit of the Octal number is replaced by an equivalent binary string of 3-bits.

Example 1:

Problem:

How to convert this 5265666 number into its Binary equivalent?

Solution:

Step 1: Separate each of the Octal number

  • 5        2          6           5         6          6           6

Step 2: 

Replace  each octal number with a number by its Octal equivalent.

  •   5        2          6           5         6          6           6
  •   101        010           110            101          110           110            110

See the table below to understand that how these octal numbers are converted into binary number.

Note: Binary strings which can not be divided into equal number of 3- bit groups are supposed to have 0’s  in the left of the bits.

Example 2:

 

Problem:

How to convert this 3265646 number into its Binary equivalent?

Solution:

Step 1: Separate each of the Octal number

  • 3        2          6           5         6          4           6

Step 2: 

Replace  each octal number with a number by its Octal equivalent.

  •   3        2          6           5         6          4           6
  •   011        010           110            101          110           100            110

See the table below to understand that how these octal numbers are converted into binary number.

Decimal Binary Octal
0 000 0
1 001 1
2 010 2
3 011 3
4 100 4
5 101 5
6 110 6
7 111 7