Title: Number Systems and Conversions
Course: Computer Fundamentals
Instructor: Muhammad Saber Oyghan
1. Decimal Number System
• Base: 10
• Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
• Example: 345 (Decimal)
• Logic and Use: Humans naturally use decimal for counting. Each digit represents a power of 10. Computers convert decimal
input into binary for processing.
Decimal to Other Systems
1. Decimal to Binary: Divide by 2 repeatedly, record remainders. Example: 13 decimal → 1101 binary
2. Decimal to Octal: Divide by 8 repeatedly, record remainders. Example: 65 decimal → 101 octal
3. Decimal to Hexadecimal: Divide by 16 repeatedly, record remainders (0-9, A-F). Example: 254 decimal → FE hexadecimal
Example: convert the number 121 to it’s binary, octal and hexadecimal equivalents.
1. Decimal to Binary:
The Decimal number 121 is equal to Binary 111100 or:
2 121 1
12110 = 11110012
2 60 0
Note: to test it or to convert it back to Decimal use the following formula, for each type of
2 30 0
number (b) takes the base of that number for example here in binary numbers b is equal
2 15 1 to 2, for octal numbers it is equal to 8, and for hexadecimal numbers it is equal to 16:
2 7 1 Decimal =an . bn + an-1 . bn-1 +…+ a0 . b0
2 3 1
In that formula (n) represents the index of the number which starts from zero, the digit at
1 the very right of the number has the index 0 and (n) is the highest index it can take for this
example it is equal to 6. To test it the binary 111100 must be equal to 121 again.
Decimal= 1 . 26 + 1 . 25 + 1 . 24 + 1 . 23 + 0 . 22 + 0 . 21 + 1 . 20 = 121
2. Decimal to octal:
8 121 1 12110 = 1718
8 15 7 Decimal= 1 . 82 + 7 . 81 + 1 . 80 = 64 + 56 + 1 = 121
1
3. Decimal to Hexadecimal:
12110 = 7916
Decimal= 7 . 161 + 9 . 160 = 121
16 121 9
7
2. Binary Number System
• Base: 2
• Digits: 0, 1
• Example: 1101 (Binary)
• Logic and Use: Binary represents two states: 0 (off) and 1 (on). Fundamental in computer hardware for data storage and
processing.
1
Binary to Other Systems
1. Binary to Decimal: Multiply each bit by 2^position and sum. Example: 1101 → 13 decimal
2. Binary to Octal: Group bits in sets of 3 and convert. Example: 1101 → 15 octal
3. Binary to Hexadecimal: Group bits in sets of 4 and convert. Example: 1101 → D hexadecimal
3. Octal Number System
• Base: 8
• Digits: 0-7
• Example: 157 (Octal)
• Logic and Use: Octal is a compact representation of binary numbers. Each octal digit represents three binary bits.
Octal to Other Systems
1. Octal to Decimal: Multiply each digit by 8^position and sum. Example: 157 → 111 decimal
2. Octal to Binary: Convert each octal digit to 3-bit binary. Example: 157 → 1110111 binary
3. Octal to Hexadecimal: Convert octal to binary, then binary to hex. Example: 157 octal → 77 hex
4. Hexadecimal Number System
• Base: 16
• Digits: 0-9, A-F
• Example: 2F (Hexadecimal)
• Logic and Use: Hexadecimal is human-friendly for binary data. Each hex digit represents 4 binary bits. Used in
programming, debugging, and memory addressing.
Hexadecimal to Other Systems
1. Hexadecimal to Decimal: Multiply each digit by 16^position and sum. Example: 2F → 47 decimal
2. Hexadecimal to Binary: Convert each hex digit to 4-bit binary. Example: 2F → 101111 binary
3. Hexadecimal to Octal: Convert hex to binary, then binary to octal. Example: 2F → 57 octal
5. Quick Conversion Table
Decimal Binary Octal Hexadecimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
15 1111 17 F
16 10000 20 10