Select Page

## Binary To Octal In C

Let’s understand the idea involved in the programming of “Binary To Octal Conversion In C“. The problem is to convert the given binary number to its equivalent octal number.

Take a binary number as input. Divide the binary number into groups of 3 bits. For each group of 3 bits, multiply each bit with the power of 2 and add them consecutively. Combine the result of all groups to get the output.

## Explanation Of Code:

1. Take a binary number as input and store it in the variable binarynum.
2. Obtain the remainder and quotient of the input number by dividing it by 10.
3. Multiply the obtained remainder with variable j and increment the variable octalnum with this value.
4. Increment the variable j by 2 and override the variable binarynum with the quotient obtained.
5. Repeat steps 2-4 until the variable binarynum becomes zero.
6. Print the variable octalnum as output.

## Top Book Suggestion

The two books on C Programming Language that I Personally Recommend. I really loved reading these books. These books are listed for quality content, easy steps, and affordable price. You can get it from Amazon and Flipkart.

### Check The Price On Amazon:

1. C Programming Beginner’s Guide

### Check The Price On Flipkart:

1. Introduction to C Programming

2. Head First C: A Brain-Friendly Guide

### Buy Premium Courses At Lowest Price. Become A Certified Developer Today!

#### Important C Programs ## Introduction to C Programming

... ...

...