Introduction:
Computers only understand 0s and 1s (binary). We humans use decimal numbers (0–9). So, converting between decimal and binary is important in computer science.
Decimal → Binary (Division by 2 Method)
Steps:
- Take the decimal number.
- Divide it by 2.
- Write down the remainder (0 or 1).
- Divide the quotient again by 2.
- Repeat until quotient = 0.
- Read the remainders from bottom to top → Binary number
Example:
Convert 24 → Binary
24 ÷ 2 = 12 remainder 0
12 ÷ 2 = 6 remainder 0
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1
Binary = 11000
So, 24 (decimal) = 11000 (binary)
Binary → Decimal (Powers of 2 Method)
Steps:
- Take the binary number.
- Write powers of 2 under each digit (starting from right, 2⁰).
- Multiply digit × power of 2.
- Add all results.
- That’s the decimal number.
Example:
Convert 11000 → Decimal
1 × 2^4 = 16
1 × 2^3 = 8
0 × 2^2 = 0
0 × 2^1 = 0
0 × 2^0 = 0
Total = 24
So, 11000 (binary) = 24 (decimal)
Binary conversion is the foundation of computer science. Once we practice a few examples, it becomes very easy.
”Thanks for reading! See you soon in a different style with more coding insights.”
Top comments (4)
Excellent madhavi mam, it's easy to understand how to decimal to binary.
Thank You sir
Super clear explanation..
Thank you