Conversion

ShareIn this tutorial we will learn binary to decimal conversion for an integer number.

Before we dive into the main topic lets talk a little about Decimal and Binary 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.

A binary number system consists of only 2 digits: 0 and 1. And it is most commmonly used in computers.

to convert a binary number into decimal form we have to multiply

ones place by 2^{0}

tens place by 2^{1}

hundreds place by 2^{2}

and so onâ€¦

The following table shows the places, binary number and the multipliers for the corresponding places.

place | thousands | hundreds | tens | ones |

binary | 1 | 0 | 1 | 0 |

multiplier | 2^{3} | 2^{2} | 2^{1} | 2^{0} |

`= 1x2`^{3} + 0x2^{2} + 1x2^{1} + 0x2^{0}
= 8 + 0 + 2 + 0
= 10

So, the required decimal number is

1010_{(base 2)} = 10_{(base 10)}

Alternatively, (1010)_{2} = (10)_{10}

Where, (base 10) means the number is in decimal number system and (base 2) means the number is in binary number system.

The following table shows the places, binary number and the multipliers for the corresponding places.

place | hundred thousands | ten thousands | thousands | hundreds | tens | ones |

binary | 1 | 1 | 0 | 1 | 0 | 1 |

multiplier | 2^{5} | 2^{4} | 2^{3} | 2^{2} | 2^{1} | 2^{0} |

`= 1x2`^{5} + 1x2^{4} + 0x2^{3} + 1x2^{2} + 0x2^{1} + 1x2^{0}
= 32 + 16 + 0 + 4 + 0 + 1
= 53

So, the required decimal number is

110101_{(base 2)} = 53_{(base 10)}

Alternatively, (110101)_{2} = (53)_{10}

Where, (base 10) means the number is in decimal number system and (base 2) means the number is in binary number system.

- 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