**Octal To Decimal In C**

Let’s understand the idea involved in the programming of “**Octal To Decimal Conversion In C**“.

Given an octal number as input, we need to write a program to convert the given octal number into an equivalent decimal number.

The idea is to extract the digits of a given octal number starting from the rightmost digit and keep a variable dec_value. At the time of extracting digits from the octal number, multiply the digit with the proper base (Power of 8) and add it to the variable dec_value. In the end, the variable dec_value will store the required decimal number.

For Example:

If the octal number is 67.

dec_value = 6*(8^1) + 7*(8^0) = 55

Take an octal number as input. Multiply each digit of the octal number starting from the last with the powers of 8 respectively. Add all the multiplied digits. The total sum gives the decimal number.

## Octal To Decimal In C

## Output:

## Explanation Of Code:

1. Take the octal number as input and store it in the variable octal.

2. Initialize the variables decimal and i to zero.

3. Obtain the remainder and quotient of the octal number. Multiply the remainder by powers of 8 using function pow(8, i++), add this value to the variable decimal and store it in the variable decimal.

4. Override the variable octal with quotient.

5. Repeat the steps 3 and 4 with the quotient obtained until the quotient becomes zero.

6. Print the variable decimal 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:**

**Check The Price On Flipkart:**

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

**Important C Programs**

**Basic C Programs**

**Programs On Number**

**String Programs**

**Array Programs**

**Sorting Programs**

**Pointer Programs**

**Star Pattern Programs**

**Number Pattern Programs**

**File Handling Programs**

**Programs On Recursion**

**Geometry Programs**

**Programs On Loop**

**Programs On Function**

**Switch Case Programs**

**If Else Programs Bitwise Operator Conditional Operator Matrix Programs Program On Calculation Number System Conversion All C programs**