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 , the octal number will remain the same.
-
If the number is greater than , divide it by and store the remainder.
-
If the quotient is greater than , keep dividing it by until the quotient becomes
-
Repeat this step until we get a quotient less than .
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:
Code explanation
- We have a number that needs to be converted into an octal number.
- Now divide this number by .
- After that, we get a quotient of and the remainder of .
- Now we have a number, which needs to divide by and get a quotient and . This is less than .
- We repeat this step until we get in the quotient.
- When we have 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 ©2026 Educative, Inc. All rights reserved