How to convert a decimal number to an octal number

Conversion steps

We can take the following steps to convert a decimal number to its octal equivalent:

  • First, take a decimal number and then check it. If the number is less than 88, the octal number will remain the same.

  • If the number is greater than 77, divide it by 88 and store the remainder.

  • If the quotient is greater than 88, keep dividing it by 88 until the quotient becomes 0.0.

  • Repeat this step until we get a quotient less than 88.

Converting procedure

The following figure illustrates the conversion of a decimal number to an octal number:

1 of 5

The following illustration demonstrates the final step of conversion:

Final step of conversion

Code explanation

  • We have a 76567656 number that needs to be converted into an octal number.
  • Now divide this number by 88.
  • After that, we get a quotient of 957957 and the remainder of 00.
  • Now we have a 957957 number, which needs to divide by 88 and get a 119119 quotient and 55. This 55 is less than 77.
  • We repeat this step until we get 00 in the quotient.
  • When we have 00 in number, we get a number in octal decimal, which we write in the reverse direction in the final result, as shown above.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved