Number Systems
To a computer, everything is a number
Numbers, letters, punctuation marks, sounds and
pictures => all are numbers
E.g. Consider the following sentence
Here are some words.
May look like a sequence of characters, but to a
computer it looks like the string of ones and zeros
as shown on next slide.
9/10/2024 2
H 0100 1000
e 0110 0101
r 0111 0010
e 0110 0101
0010 0000
a 0110 0001
r 0111 0010
e 0110 0101
0010 0000
s 0111 0011 Computer data
o 0110 1111
m 0110 1101
looks strange
e 0110 0101
0010 0000
w 0111 0111
o 0110 1111
r 0111 0010
d 0110 0100
s 0111 0011
. 0010 1110
9/10/2024 3
Number Systems
Decimal Number System
Binary Number System
Octal Number System
Hexadecimal Number System
9/10/2024 4
Decimal Number System
In our day-to-day life we use decimal number
system.
In this system base is equal to 10 because there are
altogether 10 symbols or digits
0 1 2 3 4 5 6 7 8 9.
If we need to represent a number greater than 9,
we use two symbols together as in 9 + 1 = 10
9/10/2024 DCSSE, FBAS, IIUI 5
Decimal Number System
As the number starts to become longer, the
concept of place becomes important. E.g. 132510
132510 = (1 x 103) + (3 x 102) + (2 x 101) + (5 x 100)
9/10/2024 DCSSE, FBAS, IIUI 6
Binary Number System
In computers all data is represented by the state of
computer’s electronic switches.
Switch has only two possible values (ON or OFF).
Represented by 2 numeric values
When a switch is OFF represents 0, when it is ON
represents 1.
9/10/2024 DCSSE, FBAS, IIUI 7
Binary Number System
So the Base of Binary Number System is 2, can
only use two digits 0 and 1.
Each position in binary number represents a power
of base (2).
9/10/2024 DCSSE, FBAS, IIUI 8
Conversion of Binary Number
to Decimal Number
Example: Decimal Equivalent of Binary Number
101012 is
= (1x24) + (0x23) + (1x22) + (0x21) + (1x20)
= 16 + 0 + 4 + 0 + 1
= 2110
Example 2: 01012 = ( )10
9/10/2024 DCSSE, FBAS, IIUI 9
Conversion of Decimal
Number to Binary Number
Example: Convert 13 to base 2
2 13
2 6 ---- 1
2 3 ---- 0
1 ---- 1 (1101)2
Example 2: 2310 = ( )2
9/10/2024 DCSSE, FBAS, IIUI 10
Decimal Equivalent of Binary Numbers
OR Counting in Binary Number System
Base 10 Base 2
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
9/10/2024 DCSSE, FBAS, IIUI 11
Octal Number System
Base is 8
8 symbols: {0,1,2,3,4,5,6,7}
Each place is weighted by the power of 8
Example: (345)8
9/10/2024 DCSSE, FBAS, IIUI 12
Conversion from Octal to Decimal
Example : (345)8 =( )10
= (3x82) + (4x81) + (5x80)
= 192 + 32 + 5
= (229)10
Conversion from Decimal to Octal
Repeatedly Divide by 8
Example: (952)10 = ( )8
9/10/2024 DCSSE, FBAS, IIUI 13
Conversion from Octal to Binary
Expand each octal digit to 3 binary digits.
Example: (725)8 = (111 | 010 | 101)2
Conversion from Binary to Octal
Combine every 3 bits into one octal digit
Example: (110 | 010 | 011)2 = (623)8
9/10/2024 DCSSE, FBAS, IIUI 14
Conversion from Octal to Binary 2nd
method
How to Convert Octal To Binary?
Conversion of octal to binary number is a two-step process. First, we need to
convert the given octal number into its equivalent decimal number and then
convert the decimal into binary. Let us learn the complete steps here.
Solved Examples
Q.1: Convert 418 to a binary number.
Solution: Given number is 418
418 = (4 * 81) + (1 * 80)
=4*8+1*1
= 32+1
= 33(Decimal number)
Now convert this decimal number into its equivalent binary number. Let us
draw a table to show the conversion of decimal to binary as given below.
9/10/2024 DCSSE, FBAS, IIUI 15
Convert 1228 into binary number.
Convert the octal number 2008 into its equivalent binary number.
Convert (98)8 to a binary number.
9/10/2024 DCSSE, FBAS, IIUI 16
Conversion from Binary to Octal
2nd method
Binary to Octal conversion Examples
Example 1: Convert 10101012 to octal
Solution:
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)
Now we will convert this decimal to octal form
9/10/2024 DCSSE, FBAS, IIUI 17
Therefore, the equivalent octal number is 1258.
Link of solved examples: https://byjus.com/maths/binary-to-octal-
conversion/
9/10/2024 DCSSE, FBAS, IIUI 18
Hexadecimal Number System
Base is 16
16 symbols:
{0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}
Each place is weighted by the power of 16
Example:
(3AB)16
9/10/2024 DCSSE, FBAS, IIUI 19
Conversion from Hexadecimal to
Decimal Number
(3AB4)16 to Base 10
(3AB4)16 = 3x163+10x162+11x161+4x 160
= 12288 + 2560 + 176 + 4
= 15028
Conversion from Decimal Number
to Hexadecimal
Repeated Division by 16 e.g. (428)10 = ()16
9/10/2024 DCSSE, FBAS, IIUI 20
Conversion from Hexadecimal to
Binary Number
Expand each hexadecimal digit to 4 binary
digits. E.g. (E29)16 = (1110 | 0010 | 1001)2
Conversion from Binary Number to
Hexadecimal
Combine every 4 bits into one hexadecimal
digit
Example: (0101 | 1111 | 1010 | 0110)2 = (5FA6)16
9/10/2024 DCSSE, FBAS, IIUI 21
Conversion from Hexadecimal to
Octal Number
Method 1: Step 1: HexaDecimal No. to Decimal No.
Step 2: Decimal No. to Octal No.
OR
Method 2: Step 1: HexaDecimal No. to Binary No.
Step 2: Binary No. to Octal No.
9/10/2024 DCSSE, FBAS, IIUI 22
Conversion from Octal to
Hexadecimal Number
Method 1: Step 1: Octal No. to Decimal No.
Step 2: Decimal No. to HexaDecimal No.
OR
Method 2: Step 1: Octal No. to Binary No.
Step 2: Binary No. to HexaDecimal No.
9/10/2024 DCSSE, FBAS, IIUI 23
Some Important Conversions to
Remember
Base 10 Base 2 Base 16
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
9/10/2024 15 DCSSE, FBAS, IIUI 1111 F 24
Conversion Summary
Conversion Method
BNS -> DNS Power of 2 (base) method
DNS -> BNS Repeated Division by 2 (base) method
ONS -> DNS Power of 8 (base) method
DNS -> ONS Repeated Division by 8 (base) method
ONS -> BNS Each octal digit to 3 binary digits - Refer Table Octal to Binary
BNS -> ONS Group every 3 bits into 1 octal digit - Refer Table Octal to Binary
HDNS -> DNS Power of 16 (base) method
DNS -> HDNS Repeated Division by 16 (base) method
HNS -> BNS Each hexadecimal digit to 4 binary digits - Refer Table
Hexadecimal to Binary
BNS -> HNS Group every 4 bits into 1 hexadecimal digit - Refer Table
Hexadecimal to Binary
9/10/2024 DCSSE, FBAS, IIUI 25
Conversion Summary
Conversion Method
HDNS -> ONS Method 1: Step 1: HexaDecimal No. to Decimal No.
Step 2: Decimal No. to Octal No.
Method 2: Step 1: HexaDecimal No. to Binary No.
Step 2: Binary No. to Octal No
ONS -> HDNS Method 1: Step 1: Octal No. to Decimal No.
Step 2: Decimal No. to HexaDecimal No.
Method 2: Step 1: Octal No. to Binary No.
Step 2: Binary No. to HexaDecimal No.
Any NS -> DNS Power of base method
DNS -> Any NS Repeated Division by base method
Any NS -> Any Step 1: Any No. to Decimal No.
other NS Step 2: Decimal No. to Any No.
Note: Any NS could be other than already discussed number systems
26
in this lecture. For example, any NS with base 5, base 9, etc.
‘A prudent question is one-half of wisdom’
(Francis Bacon)