C Program to Convert Binary Number to Octal and vice-versa

To understand this example, you should have the knowledge of the following C programming topics:


Program to Convert Binary to Octal

In this program, we will first convert a binary number to decimal. Then, the decimal number is converted to octal.

Output

Enter a binary number: 101001
101001 in binary = 51 in octal

Program to Convert Octal to Binary

In this program, an octal number is converted to decimal at first. Then, the decimal number is converted to binary number.

Output

Enter an octal number: 67
67 in octal = 110111 in binary