Computers use different number systems to represent and process data. The most common are:
1. Decimal Number System (Base 10)
- Digits used: 0 to 9 (10 symbols).
- It is the number system we use in daily life.
- Example: 325 (3×10² + 2×10¹ + 5×10⁰).
2. Binary Number System (Base 2)
- Digits used: 0 and 1 only.
- Each digit is called a bit.
- It is the language of computers (machine language).
- Example: (1011)₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 11 (Decimal).
3. Octal Number System (Base 8)
- Digits used: 0 to 7.
- Example: (537)₈ = 5×8² + 3×8¹ + 7×8⁰ = 351 (Decimal).
4. Hexadecimal Number System (Base 16)
- Digits used: 0–9 and A–F (where A=10, B=11, …, F=15).
- Used in computer memory addresses, color codes (like HTML).
- Example: (2F)₁₆ = 2×16¹ + 15×16⁰ = 47 (Decimal).
Inter-Conversions of Number Systems
A. Decimal → Other Systems
- Decimal → Binary
- Divide the decimal number by 2 repeatedly, write remainders in reverse.
- Example: (13)₁₀ → divide by 2 → 1101₂.
- Decimal → Octal
- Divide by 8 repeatedly.
- Example: (125)₁₀ → 175₈.
- Decimal → Hexadecimal
- Divide by 16 repeatedly.
- Example: (254)₁₀ → FE₁₆.
B. Binary → Other Systems
- Binary → Decimal
- Multiply each digit by 2ⁿ (from right to left).
- Example: (10101)₂ = 21₁₀.
- Binary → Octal
- Group binary digits in 3 bits (right to left).
- Example: (110101)₂ → (110)(101) → 65₈.
- Binary → Hexadecimal
- Group binary digits in 4 bits.
- Example: (10111100)₂ → (1011)(1100) → BC₁₆.
C. Octal ↔ Hexadecimal (via Binary)
- Convert Octal → Binary → Hexadecimal.
- Example: (745)₈ → Binary: 111100101 → Group in 4 bits → (1 1110 0101) → 1E5₁₆.
Quick Reference Table
Decimal | Binary | Octal | Hexadecimal |
---|---|---|---|
0 | 0000 | 0 | 0 |
1 | 0001 | 1 | 1 |
2 | 0010 | 2 | 2 |
3 | 0011 | 3 | 3 |
4 | 0100 | 4 | 4 |
5 | 0101 | 5 | 5 |
6 | 0110 | 6 | 6 |
7 | 0111 | 7 | 7 |
8 | 1000 | 10 | 8 |
9 | 1001 | 11 | 9 |
10 | 1010 | 12 | A |
11 | 1011 | 13 | B |
12 | 1100 | 14 | C |
13 | 1101 | 15 | D |
14 | 1110 | 16 | E |
15 | 1111 | 17 | F |
✅ Summary for Exams
- Binary = Base 2 (0,1)
- Octal = Base 8 (0–7)
- Decimal = Base 10 (0–9)
- Hexadecimal = Base 16 (0–9, A–F)
- Conversion → Repeated division or grouping method.