Week5&6
Week5&6
05 1 st Semester
Number System
Instructor: Sundas rana
Why Number system
Teaching the number system in ICT (Information and
Communication Technology) or Computer Science is fundamental
because it helps students understand how computers process and
store data.
03/24/2025 2
What is a Number System?
Definition: A number system is a writing system for expressing
numbers. It defines how numbers are represented using symbols
(digits) and their corresponding positional values.
Key Concept: Computers use different number systems to process,
store, and transmit data efficiently.
03/24/2025 3
Why Do We Need Different Number
Systems?
Efficiency: Computers use binary (base-2) because they operate
with electrical signals, which are either ON (1) or OFF (0).
Data Representation: Various number systems make it easier to
handle different data types, like memory addresses and instructions.
Compact Representation: Number systems like hexadecimal (base-
16) provide a compact way of representing large binary values,
which makes reading and interpreting binary data more
manageable.
03/24/2025 4
Importance of Number Systems in
Computer Science
Binary Logic and Circuits: All data and instructions in a computer
are handled in binary form.
Data Storage: Memory (RAM), hard drives, and processors store
and process data in binary form.
Networking: IP addresses and MAC addresses use binary and
hexadecimal formats for efficient communication.
Programming: Hexadecimal is frequently used in low-level
programming and debugging.
03/24/2025 5
Why Conversion Between Number
Systems is Important in Computing
Efficient Communication with Computers
Binary is the native language of computers, but humans are familiar
with using decimals.
Conversion allows us to interact with computers effectively. For
example:
Programmers work with hexadecimal for readability but need to convert it to
binary for machine-level operations.
Decimal to binary conversion is common when programming or configuring
devices like routers, which may require binary or hexadecimal inputs.
03/24/2025 6
Why Conversion Between Number
Systems is Important in Computing
Memory and Storage
Binary Data Storage: Computers store all types of data—whether
numbers, text, or multimedia—in binary form. For humans to
interpret the data, conversion between systems (e.g., binary to
decimal) is necessary.
Addressing in Memory:
Memory addresses are often represented in hexadecimal for convenience
because it’s shorter and more readable than binary.
Conversions help programmers understand or manipulate data stored at
specific memory locations.
03/24/2025 7
Networking and IP Addressing
IPv4 Addresses:
IP addresses are typically represented in decimal, but they are actually
processed as binary by computers.
Conversion between binary and decimal is essential for understanding
network configurations.
MAC Addresses:
MAC addresses use hexadecimal for easier reading and understanding of
hardware identifiers.
03/24/2025 8
Arithmetic Operations and Logic
Binary Arithmetic:
Computers perform all calculations using binary, but humans find it easier to
perform math in decimal.
Conversion between decimal and binary is needed for manual calculations,
verification, or debugging during system design.
Boolean Logic:
Digital circuits use binary logic (1s and 0s), but understanding the logic often
requires converting inputs and outputs to more intuitive forms like decimal or
hexadecimal.
03/24/2025 9
Number Systems
Number Systems
Decimal Number System
Binary Number System
Octal Number System
Hexadecimal Number System
Number Systems
Number Systems
Decimal Number System
Decimal Number System
Example
Binary Number System
Binary Number System
Example
Representing Numbers in Different
Number Systems
BIT
Exercise
1. 1111 → 15
2. 101010 → 42
3. 1101101 → 109
4. 10101010 → 170
5. 11111111 → 255
03/24/2025 19
Octal Number System
Octal Number System
Hexadecimal Number System
A Hexadecimal number system has sixteen (16)
alphanumeric values from 0 to 9 and A to F. Every number
(value) represents with 0,1,2,3,4,5,6, 7,8,9,A,B,C,D,E and F in
this number system. The base of hexadecimal number system
is 16, because it has 16 alphanumeric values. Here A is 10, B is
11, C is 12, D is 14, E is 15 and F is 16.
Hexadecimal Number System
Number Base Conversion
As, we have four types of number systems so each one can be
converted into the remaining three systems. There are the following
conversions possible in Number System
Decimal to other Number Systems.
Binary to other Number Systems.
Octal to other Number Systems.
Hexadecimal to other Number Systems.
Decimal to Binary
The steps to convert Decimal Numbers to Binary numbers are given
below:
1st Step: Check if the given decimal number is less than 2. If it is less
than 2 then the given Decimal No is the same when converted to its
binary equivalent.
2nd Step: If the given decimal number is greater than 2, then divide the
given number by 2.
3rd Step: Note down the Remainder.
4th Step: Repeat steps 2 and 3 until the quotient is less than 2.
5th Step: Now note down the remainders from bottom to top.
Note: If the given Decimal Number is even then the remainder will be
0. If the given Decimal Number is odd then the given number will be 1.
Decimal to Binary
Decimal numbers can be converted to binary by repeated division of
the number by 2 while recording the remainder. Let’s take an example
to see how this happens.
The remainders are to be read from bottom to top to obtain the
binary equivalent.
4310 = 1010112
Decimal to Binary Examples
(51)10 = (110011)2
(217)10 = (11011001)2
(8023)10 = (1111101010111)2
(37)10 = (100101)2
Decimal to Octal
Decimal numbers can be converted to octal by repeated division of
the number by 8 while recording the remainder. Let’s take an example
to see how this happens.