Computer Basics
📚 How to convert a binary number to decimal?#
Binary is a numbering system based on 2, where each digit (called a bit) can be either 0 or 1. Each bit represents a power of 2, starting from 2^0 on the right.
Step-by-step method:#
- Write down the binary number.
- Associate a power of 2 with each bit, starting from the right.
- Multiply each bit by the corresponding power of 2.
- Add everything together to get the decimal number.
🔎 Example: Convert 10110 (binary) to decimal
The binary number 10110 corresponds to: 1×2^4 + 0×2^3 + 1×2^2 + 1×2^1 + 0×2^0
Let's calculate each term:
- 1×2^4 = 16
- 0×2^3 = 0
- 1×2^2 = 4
- 1×2^1 = 2
- 0×2^0 = 0
Now, let's add them up: 16 + 0 + 4 + 2 + 0 = 22
Therefore, 10110 (binary) = 22 (decimal).