Conversion

ShareIn 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

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

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.

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}

- ES6 - Template Literals (Template strings) ES6 JavaScript
- ES6 - var let const ES6 JavaScript
- How to install Apache, MySQL, PHP on macOS Catalina 10.15 How to Mac
- How to install Apache, MySQL, PHP on macOS Mojave 10.14 How to Mac
- Exercise 1 Flowchart
- How to install PostgreSQL on Mac using Homebrew How to Mac
- How to change default shell to bash on macOS Catalina How to Mac
- How to backup and restore MySQL or MariaDB database using mysqldump Reference Database
- HTML Getting Started HTML
- ChartJS | How to create Doughnut Chart using data from MySQL (MariaDB) table and PHP ChartJS