Decimal to Octal conversion of Integer number

Conversion

Share

In this tutorial we will learn to convert a decimal number into octal number.

Before we dive into the main topic lets talk a little about Decimal and Octal Number System that we are going to work with in this tutorial.

A decimal number system consists of 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. So, any number that we use in our daily life is actually in decimal number system.

In Octal number system we use eight digits.
0, 1, 2, 3, 4, 5, 6 and 7
Octal implies base 8

How to convert a decimal number into Octal?

To convert a decimal number into Octal we divide the number by 8 till the dividend becomes less than 8.

Convert decimal number 20 into octal form.

So, our dividend is 20 and as we are finding octal of 20 so we will divide it by 8. Thus, the divisor is 8.


Step 1
----------------
Dividend = 20
Divisor = 8
Quotient = 2

8 ) 20 ( 2
    16
   ----
     4

Dividing 20 by 8 we will get 4 as remainder.
So, 1st remainder = 4
Dividend for step 2 = quotient of step 1
So, dividend for step 2 = 2

Step 2
-----------------
Dividend = 2

As, dividend is less than 8 so, we will stop here and copy the dividend as the last remainder.
So, 2nd remaider = 2

The calculated remainder are as followed.
1st remainder = 4
2nd remainder = 2

To find the octal we have to scan the remainder from bottom.
So, 20(base 10) = 24(base 8)
Alternatively, (20)10 = (24)8
Where, (base 10) means the number is in decimal number system and (base 8) means the number is in octal number system.

Convert decimal number 110 into octal form.

So, our dividend is 110 and the divisor is 8.


Step 1
----------------
Dividend = 110
Divisor = 8
Quotient = 13

8 ) 110 ( 13
     96
   -----
      6

Dividing 110 by 8 we will get 6 as remainder.
So, 1st remainder = 6
Dividend for step 2 = quotient of step 1
So, dividend for step 2 = 13

Step 2
----------------
Dividend = 13
Divisor = 8
Quotient = 1

8 ) 13 ( 1
     8
   -----
     5

Dividing 13 by 8 we will get 5 as remainder.
So, 1st remainder = 5
Dividend for step 2 = quotient of step 1
So, dividend for step 2 = 1

Step 3
-----------------
Dividend = 1

As, dividend is less than 8 so, we will stop here and copy the dividend as the last remainder.
So, 3rd remaider = 1

The calculated remainder are as followed.
1st remainder = 6
2nd remainder = 5
3rd remainder = 1

To find the octal we have to scan the remainder from bottom.
So, 110(base 10) = 156(base 8)
Alternatively, (110)10 = (156)8