0% found this document useful (0 votes)
18 views59 pages

Week5&6

The document provides an overview of number systems, emphasizing their importance in computer science and ICT. It explains various number systems including binary, decimal, octal, and hexadecimal, and discusses the necessity of conversions between these systems for efficient data processing and representation. Additionally, it includes examples and exercises for converting numbers between different systems.

Uploaded by

f24607016
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views59 pages

Week5&6

The document provides an overview of number systems, emphasizing their importance in computer science and ICT. It explains various number systems including binary, decimal, octal, and hexadecimal, and discusses the necessity of conversions between these systems for efficient data processing and representation. Additionally, it includes examples and exercises for converting numbers between different systems.

Uploaded by

f24607016
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 59

Lecture No.

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. Convert the binary number 1111 to decimal.


2. Convert the binary number 101010 to decimal.
3. Convert the binary number 1101101 to decimal.
4. Convert the binary number 10101010 to decimal.
5. Convert the binary number 11111111 to decimal.

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.

Reading the remainders from bottom to top,


47310 = 7318
Decimal to Octal
Decimal to Octal Conversion
Convert 45610 to octal
Convert 21210 to octal
Convert 10110 to octal
Convert 12710 to octal
Convert10010 to octal
Decimal to Hexadecimal
Decimal to Hexadecimal
Decimal numbers can be converted to octal by repeated division of
the number by 16 while recording the remainder.

Reading the remainders from bottom to top we get,


42310 = 1A716
Decimal to Hexadecimal
(960)10 = (3C0)16
4910 = 3116
756210 = 1D8A16
Binary to Decimal:
In this conversion, binary number to a decimal number, we use
multiplication method, in such a way that, if a number with base n
has to be converted into a number with base 10, then each digit of
the given number is multiplied from MSB to LSB with reducing the
power of the base.
 Let us understand this conversion with the help of an example.
Example 1
 Convert (1101)2 into a decimal number.
Solution: Given a binary number (1101)2
Now, multiplying each digit from MSB to LSB with reducing the power
of the base number 2.
1 × 23 + 1 × 22 + 0 × 21 + 1 × 20
= 8 + 4 + 0 + 1
= 13
Therefore, (1101)2 = (13)10
Conversion from Binary to Octal number
system
Octal number system provides convenient way of converting large
binary numbers into more compact and smaller groups. There are
various ways to convert a binary number into octal number. You can
convert using direct methods or indirect methods. First, you need to
convert a binary into other base system (e.g., into decimal, or into
hexadecimal). Then you need to convert it octal number.
Binary to Octal- Direct method (Grouping)
Step 1 − Divide the binary digits into groups of three (starting from
the right).
Step 2 − Convert each group of three binary digits to one octal digit.
Using Grouping
Since, there are only 8 digits (from 0 to 7) in octal number system, so
we can represent any digit of octal number system using only 3 bit as
following below.
Using Grouping
So, these are following steps to convert a binary number into octal
number.
1. Take binary number
2. Divide the binary digits into groups of three (starting from right) for
integer part and start from left for fraction part.
3. Convert each group of three binary digits to one octal digit.
This is simple algorithm where you have to grouped binary number and
replace their equivalent octal digit.
Using Grouping
Convert binary number 1010111100 into octal number.
Binary To Octal : Indirect Conversion
Example 1: Convert 10101012 to octal Now we will convert this decimal to
octal form
Given binary number is 10101012
First, we convert given binary to
decimal
10101012 = (1 * 26) + (0 * 25 ) + (1 * 24)
+ (0 * 23) + (1 * 22) + (0 * 21) + (1 * 20)
= 64 + 0 + 16 + 0 + 4 + 0 + 1
= 64 + 21
0101012= 85 (Decimal form)
 the equivalent octal number is 1258
Binary To Hexadecimal- Indirect
Conversion
Firstly, convert the given binary number into decimal.
Then, convert the obtained decimal into hexadecimal.
Example
 Convert (0111000101001)2(0111000101001)2 to  Once the decimal number is obtained, we
Hexadecimal. convert this decimal number to a hexadecimal
 We first convert the binary number to a decimal number. The number is divided by 16 until the
number. To do that each digit is multiplied with the quotient is zero.
corresponding power of two.  3625/16 = 226 is the quotient, the remainder is
 (0111000101001)2(0111000101001)2 = 0 × 212 + 1 × 9
211 + 1 × 210 + 1 × 29 + 0 × 28 + 0 × 27 + 0 × 26 + 1 ×
25 + 0 × 2 4 + 1 × 2 3 + 0 × 2 2 + 0 × 2 1 + 1 × 2 0  226/16 = 14 is the quotient, the remainder is 2
 (0111000101001)2(0111000101001)2 = 0 × 4096 +  14/16 = 0 is the quotient, remainder is 14
1 × 2048 + 1 × 1024 + 1 × 512 + 0 × 256 + 0 × 128 + 0  The final number is obtained by arranging the
× 64 + 1 × 32 + 0 × 16 + 1× 8 + 0 × 4 + 0 × 2 + 1 × 1 numbers from bottom to top i.e. 1429. Since
 (0111000101001)2(0111000101001)2 = 0 + 2048 + the hexadecimal number system only deals
1024 + 512 + 0 + 0 + 0 + 32 + 0 + 8 + 0 + 0 + 1 with 0 - 9 in numbers and 10 -15 in alphabets
 (0111000101001)2(0111000101001)2 = 3625 as A - F, so the number is E29.
 Therefore, (0111000101001)2(0111000101001)2 = (  Therefore, (0111000101001)2(0111000101001
3625)10(3625)10. )2 = (E29)16(E29)16.
Method 2: (Direct Method for converting
binary to hexadecimal)
Take the given binary number and form the
collection of four bits called a quad, then
replace the quad with its hexadecimal
equivalent. Hence, the obtained number is
the conversion of a given binary to
hexadecimal.
Method 2: (Direct Method for converting
binary to hexadecimal)
Convert: (111111101)2 = (_________)16
(111111101)2 = 0001 1111 1101 (The bold three 0s are added before 1
as it is integral part (before the radix point))
=1FD
= (111111101)2 = (1FD)16
Method 2: (Direct Method for converting
binary to hexadecimal)
Question 2: Convert: (01011110001)2 = (_________)16
(01011110001)2 = 0010 1111 0001 (The bold one 0s are added before 1
as it is integral part (before the radix point))
=2F1
= (01011110001)2 = (2F1)16
Octal to Binary Conversion
The base of the octal number system (8) is the third power of base of
a binary system (2), the interconversion of octal and a binary number
is very simple and direct as explained below.
Let converting the octal number 35.346 to its equivalent binary
number
Octal to Binary
Steps to Convert Octal to Decimal
Step 1: Since an octal number only uses digits from 0 to 7, we first
arrange the octal number with the power of 8.
Step 2: We evaluate all the power of 8 values such as 80 is 1, 81 is 8,
etc., and write down the value of each octal number.
Step 3: Once the value is obtained, we multiply each number.
Step 4: Final step is to add the product of all the numbers to obtain
the decimal number.
Steps to Convert Octal to Decimal
How to convert octal to
hexadecimal ?
Octal to Hexadecimal
Hexadecimal to other Number
Systems
Binary, Octal, Decimal
Hexadecimal to Binary
Hexadecimal to Decimal
ex is a base 16 number and decimal is a base 10 number. We need to
know the decimal equivalent of every hex number digit. See below of
the page to check the hex to decimal chart.
Here are the steps to convert hex to decimal:
Get the decimal equivalent of hex from table.
Multiply every digit with 16 power of digit location.
(zero based, 7DE: E location is 0, D location is 1 and the 7 location is 2)
Sum all the multipliers.
Hexadecimal to decimal
Convert B6A16 to its decimal
equivalent.
Hexadecimal to octal

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy