Computer Fundamentals - Number Systems
1. Number System
A number system is a way to represent numbers. The most common number systems in computers
are:
• Decimal (Base 10): Digits 0–9. Example: 145.
• Binary (Base 2): Digits 0,1. Example: 1011.
• Octal (Base 8): Digits 0–7. Example: 67.
• Hexadecimal (Base 16): Digits 0–9 and A–F. Example: 2F.
Computers work internally in binary but we use decimal or hexadecimal for readability.
2. Conversion
Conversions are needed to switch between number systems.
• Decimal to Binary: Divide by 2 and note remainders. (Ex: 13 → 1101)
• Binary to Decimal: Multiply digits by powers of 2. (Ex: 1101 → 13)
• Decimal to Octal: Divide by 8. (Ex: 125 → 175)
• Decimal to Hexadecimal: Divide by 16. (Ex: 255 → FF)
• Binary to Hexadecimal: Group binary into 4 bits. (Ex: 101011 → 2B).
3. Uses of Hexadecimal
Hexadecimal numbers are widely used because they are compact and easy to read.
• Used in memory addresses (e.g., 0x3F2A).
• Used in machine code representation.
• Used in color codes in web design (e.g., #FF5733).
• Easier to convert from binary (4 bits = 1 hex digit).
4. Binary Addition
Rules of binary addition:
•0+0=0
•0+1=1
•1+0=1
• 1 + 1 = 10 (carry 1)
Example: 1011 + 1101
= 11000 (Decimal: 11 + 13 = 24).
5. Logical Shift
Logical shift is a bitwise operation used to move bits left or right.
• Left Shift (<<): Shifts bits to the left, adds 0 on the right.
Example: 1010 << 1 = 10100 (Decimal 10 → 20).
• Right Shift (>>): Shifts bits to the right, adds 0 on the left.
Example: 1010 >> 1 = 0101 (Decimal 10 → 5).
Logical shifts are used in multiplication/division by 2.