Computer Application
Chapter 1 :Number Systems
By
Mr. Kale O.V.
Number System: Chapter 1
We will study :
Types of Number Systems;
Decimal
Binary
Octal
Hexadecimal
Conversions of Decimal to binary, Binary to Decimal .
Conversions of Octal to Binary, Binary to Octal.
Conversions of Hexadecimal to Binary, Binary to Hexadecimal.
Binary Addition,
Binary Subtraction with one’s complement ; Two’s Complement method,
Binary Multiplication, and Binary Division.
Number System
Decimal Number System
Binary Number System
Octal Number System
Hexa decimal Number System
Number System
Let us Begin with the
Decimal Number
System.
Number System
Decimal Number System: Decimal
System requires 10 as Base and
10 Digits from 0 to 9.
It is widely used and universal
number system in day to day life.
Number System
As it has base 10 and used 0,1,2,3,4,5,6,7,8,9
distinct numbers to create a Decimal Number .
Weightage of every number is based on its power
of 10.
To construct any decimal number consider the
Example.
Number System
Example: Consider Decimal no 4872.
In this number 2 is at Units Place.
7 –Tens place, 8– hundred place, and 4—
thousand place.
Butfrom where comes these unit ,ten,
hundred, thousand……?
It is powers of 10 from right towards left.
Number System
Means units place is 0 power of base 10, ten- 1
power of base 10, hundred – 2 power of base 10
…..so on…
So..4872 = 4 x 103 + 8 x 102 + 7 x 101 + 2 x 100.
i.e 4x1000+ 8x100+7x10+2x1
Simply, in words , 4 thousand 8 hundred seventy
two.
Number System
So, thus power from left side of the
digit increase towards right as
4 x 103 + 8 x 102 + 7 x 101 + 2 x 100
Number System
Number System
Number System
Inshort we can summarize
decimal number system as
mentioned below.
Number System
Decimal Number System
It consists of 10 digits – 0 1 2 3 4 5 6 7 8 9
All numbers represented as combination
of digits 0-9
E.g. 3410 , 596510, 86732110 actually used
to written as 34, 5965, 867321
Number System
Position, Value and Quantity
Position 3 2 1 0 . -1 -2 -3
Position 103 102 101 100 . 10-1 10-2 10-3
value
Quantity 1000 100 10 1 . .1 .01 .001
Binary Number System
Now, Let us talk about Binary Number System.
Similar to Decimal we can construct the Binary number.
It has Base 2
There are two distinct digits (0 and 1) to represent the quantity.
These 2 digits are called binary digits or bits.
All electronic machines are using the signal + and – ie 1 and 0 respectively to
represent the signal value.
As computer is electronic device it is also using simple binary digits.
Binary Number System
Here, we can say that, 1 = ON and 0 = Off. Signal in electronic data value.
A Binary number consists of only 0 and 1 ;
no other digit is added in it.
Binary Number System
Now consider the example
100101
A binary number is made up of “0” and “1”.
Each digit is called as bit.
So 100101 is 6 bits binary number having base “2”.
Decimal Number Its Binary Equivalent Number
0 0
1 1
2 10
3 11
4 100
5 101
6 110
7 111
8 1000
9 1001
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111
Octal Number System
Octal Number System
Octal Number System
It has Base 8
And only 8 digits namely 0,1,2,3,4,5,6,7 are used.
Octal Number System
Octal Number System
Example:
278 = 2 x 81 + 7 x 80
= 16+7 = 23
43078 = 4 x 83 + 3 x 82 + 0x81 + 7 x 80
= 2048 + 192 + 0 + 7
= 2247
Octal Number System
Octal Number System
Characters = 0 1 2 3 4 5 6 7
4 3 7 = 4 x 82 + 3 x 81 + 7 x 80
64’s place 8’s place 1’s place = 4 x 64 + 3 x8 + 7x1
Written as
4378 or 437o
Octal Number System
Octal Number system
Since its base 8 = 23; every 3 bit group of binary can be represented
by an octal digit.
An Octal number is thus 1/3rd the length of the
corresponding binary number
Octal symbol Binary Eq7uivalent
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
Hexadecimal Number System
Hexadecimal
Number System
Hexadecimal Number System
Hexadecimal Number system has base 16
Requires digits from 0 to 9 and alphabets from A to F
Table showing position of all numbers and alphabets in Hexadecimal System.
Number / Alphabet Position
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
A 10
B 11
C 12
D 13
E 14
F 15
Hexadecimal Number System
Hexadecimal System
Example:
2816 = 2 x 161 + 8 x 160
= 32 + 8 = 40
BC1216 = 11 x 163 + 12 x 162 + 1 x 161 + 2 x 160
= 45056 + 3072 + 16 + 2
= 48146
(*As per Table B = 11 and c = 12)
Hexadecimal Number System
Hexadecimal Number system Base =16
Characters = 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
E 4 c = 14 x 256 + 4 x 16 + 12 x1
256’s Place 16’s place 1’s place
Written as E4Ch or E4C16
Hexadecimal Number System
Hexadecimal Number system
Ir’s is Base =16
It consists of 16 digits from 0,1,2,3,4,5,6,7,8,9 and Alphabets A,B,C,D,E,F
The alphabets A to F represent decimal numbers 10 to 15 as per table.
Ex: 29716
BA5916
BACA16
Hexadecimal Number System
Conversions
We will Study the following types of Conversions.
Decimal to Binary Binary to Decimal
Octal to Binary Binary to Octal
Hexadecimal to Binary Binary to Hexadecimal
Conversion of Decimal to binary
Conversion of Decimal to binary
In order to convert any decimal number to binary, it is need to divide the
decimal number by 2 until we get reminder as 0 or 1.
But question is why it is need to divide by only 2 : Ans is binary number has
base 2.
Then, after division by the 2 until reminder 1 or 0,
Note down the reminders in reverse order and that will be our binary
equivalent.
It will be understand by solving the example:
Hexadecimal Number System
Now consider decimal number 5.
To obtain its binary equivalent let us divide by 2 until reminder 0 or 1.
2 5 1 (Reminder)
2 2 0 (Reminder) 1 0 1
1 1 (reminder)
Now, write the obtained reminders after division from bottom to top,
As mentioned or shown in diagram.
So thus binary Equivalent for Decimal number 5 is 101
Note : it is not One Hundred one
Conversion of Decimal to binary
Consider another e.g.
Decimal no 46
Step 1 -- 46/2= 23 (reminder=0)
Step 2 -- 23/2=11 (reminder = 1) Now, take those reminders from
bottom to top i.e.
Step 3 – - 11/2 = 5 (reminder = 1) 101110
Step 4 -- 5/2= 2 (reminder = 1) is our Binary Equivalent of 46.
Step 5 –- 2/2 = 1 (Reminder = 0)
Step 6 -- 1/2 = 0 (reminder = 1)
Binary to Decimal Conversions
Now consider, Binary to Decimal Conversions
In order to obtain decimal number from binary, need to multiply every digit or
bit of binary number by 2 with with increase in power of 2 from right to left .
And take the addition of it.
It will be understand easily by the Example.
Binary to Decimal Conversions
Let us take the same e.g. i.e. 101 to obtain its decimal number.
1 0 1
Now multiply it 2 with its increasing powers from right as
1 x 2 2 + 0 x 21 + 1 x 20
4 + 0 + 1 =5,
Answer = 5
Binary to Decimal Conversions
E.g. 2 ) How to convert 101110 to its decimal Number?
Multiply with 2 with its powers increasing from right most digit .
101110 =
1 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 1 x 21 + 0 x 20
32 + 0 + 8 + 4 + 2 + 0
= 46
Conversion Octal to Binary.
Conversion Octal to Binary.
In order to convert octal number into binary number;
First Convert each octal digit into 3-digit binary number and then combine all
the binary groups of 3- digits into single binary number.
Conversion Octal to Binary.
E.g. Convert the octal 7631 to its binary equivalent.
1. Separate the digits of the given octal number, if it contains more than one
digit.
7 6 3 1
Find the binary equivalent of each digit. And add 0’s to the left if any of
the binary equivalent is shorter than 3 bits.
7 6 3 1
111 110 011 001
Write the all groups together maintaining the same group order.
111110011001 is the Ans.
Note: Use the Table to get binary eq of all no.s
Conversion Binary to Octal
Conversion Binary to Octal : In order to convert binary number into octal
number first separate digits of binary number into groups of 3 bits and then
find equivalent octal number of each group(3bits),
Then write all the group’s octal numbers together maintaining the group
order.
Conversion Binary to Octal
E.g. Convert binary number 111110011001 to octal number.
1. Separate the digits of given binary number into groups of 3 bits as.
111 110 011 001
2. Find the equivalent octal number for each group.
111 110 011 001
7 6 3 1
Write the all group’s octal numbers together maintaining the group order.
7631 is the octal number and our Answer.
Conversions of Hexadecimal to Binary.
Conversions of Hexadecimal to Binary.
In order to convert Hexadecimal number into binary number;
First Convert each hexadecimal digit into 4-digit binary number and then
combine all the binary groups of 4- digits into single binary number.
Find the binary equivalent of each digit. And add 0’s to the left if any of
the binary equivalent is shorter than 4bits.
Conversions of Hexadecimal to Binary.
In order to convert Hexadecimal numbers to binary,
You have to remember equivalent binary numbers for the first 16 hex digits.
Conversions of Hexadecimal to Binary.
E.g.
Hexadecimal number 9AF
Binary number = 1001 for 9 1010 for A (10) 1111 for F(15),
So, the number comes out to be 100110101111. that is the binary equivalent.
E.g. CE45
Take binary of each digit in 4-digit format and group them as
C E 4 5
1100 1110 0100 0101
Collectively 1100111001000101 is ans.
Binary to Hexadecimal
Now Binary to Hexadecimal
In order to convert binary number into hexadecimal
Make the 4-digit groups and convert them into hex values.
Binary to Hexadecimal
E.g.
101100110101
1011 0011 0101 make the 4-digit group
1011 0011 0101
B 3 5 (Hex Value)
Binary to Hexadecimal
E.g. Convert 0011100110100010 into its hexadecimal equivalent.
Binary 0011 1001 1010 0010
Hexadecimal 3 9 A 2
E.g. Convert 0010 1011 1000 0001. 1001 1000
Hex 2 D 8 1 . 9 8
To Conclude, we can say that each of these equivalents can be converted into
the other. The following table shows various in different number systems.
Decimal Binary Octal Hexadecimal
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Binary Addition.
Binary Addition is similar to normal decimal addition except the fact that it
carries a value of 2 instead 10. this is because in binary number system 2 is
represented as 10.
Binary Addition.
In binary System, Addition has following Rules.
Case A+B Sum Carry
1 0+0 0 0
2 0+1 1 0
3 1+0 1 0
4 1+1 0 1
Binary Addition.
E.g. Add 10010 + 1001 it will be calculated as
10010
+ 1001
Ans 11011
E.g. Suppose we have to Add 00111 and 10101 ; it will be done as.
0 1 1 1 (Carried forward values)
0 0 1 1 1
+ 1 0 1 0 1
1 1 1 0 0 Answer of Addition
Binary Subtraction.
Binary subtraction is also similar to that of normal subtraction except the fact
that when 1 is subtracted from 0; it is borrowed from next higher order bit
and that bit is reduced by 1.
Binary Subtraction.
Binary Subtraction Table rules.
Case A-B Subtraction Borrow
1 0-0 0 0
2 1-0 1 0
3 1-1 0 0
4 0-1 1 1
Note: when we subtract 1 from 0 i.e. 0-1 ; it will be borrow 1 from higher
adjescent number so that 0 becomes 10 means its decimal value is 2; and 2-1
is 1 so the answer will 1 and same time adjacent higher digit get reduced by
1. and become 0.
Binary Subtraction.
E.g. Suppose we have to subtract 101 from 1001 ( in decimal 9-5=? Ans must
be 4 ; let us calculate in binary sub method 1)
0 1(borrowed)
1 0 0 1
- 1 0 1
1 0 0 ans i.e. 4 in decimal
Binary Subtraction.
One’s Complement Method :
What is the One’s Complement?
Definition: The one’s Complement of a binary number is defined as the value
obtained by inverting all the bits in the binary number (swapping 0s for 1s and
1s for 0s).
Binary Subtraction.
In this method, we subtract two binary numbers using carried by 1’s
complement.
E.g. 1) 110101-100101=? ( Case 1: when 1st no greater than 2nd Ans is Positive)
Solution: 1’s complement of second number ie 100101 is 011010 (by swapping
1 for 0 and 0 for1 )
Now add these two numbers as
1 1 0 1 0 1
+ 0 1 1 0 1 0
1 0 0 1 1 1 1
+ 1
0 1 0 0 0 0 --- Answer
Binary Subtraction.
Case 2: when 1st number is smaller than 2nd number ; (ans is negative)
E.g. 101011-111001=?
Sol: 1’s complement of 111001 is 000110 ; now add to 1st no.
101011
+000110
110001 ---- ( Take the 1’s Complement of this product again and give it – sign)
i.e 001110 with negative sign so. -001110 is ths ans
Binary Subtraction.
Example of 1’s Complement
Subtract (1010) from (1111) ( Decimal values are as : 15-10=? We know
ans is 5 ; so let us see in binary)
Direct subtraction method
1111 ( Decimal value is 15)
- 1010 ( Decimal value is 10)
0101 ( Our Ans is Equivalent of 5 )
Binary Subtraction.
Now same example with 1’s complement method
1111 – 1010=?
Take 1’s complement of 1010 = 0101; and add to first number
1111
+0101
10100 now here product is having 5 bits , so the leftside carry 1 is to
be added in remaining bits as 10100 remove the carry and add as 10100
0100 are remaining digits add carry 1 to it 0 1 0 0 + 1
Ans is 101 ( Decmal Value =5 )
Binary Subtraction.
Two’s Complement Method:
In order to get Two’s Complement of a number, we should write the number in
binary format ; invert its digits(ie its 1”s Complement) and Add 1 to it.
First Write the number in binary form 1010 then it’s 1’s complement is
0101 then Add 1 to it : 0101+1 = 0110; so 0110 is 2’s Complement.
E.g. Case 1) Big number – Small number=? ( Positive answer )
Lets study same example ie. 1111-1010=? (in Decimal: 15-10=? Ans as we
know. 5 Lets check out with the 2’s Complement Method.
Binary Subtraction.
1111-1010=?
1111 -- First number
0101 --- 1’s complement of 2nd number
0101+1= 0110 is – 2’s complement of 2nd number
Now, Add these two and drop the carry.
1111
+ 0110
10101 --- here, Drop the left side 1 digit from the product ,
i.e. 0101 --- is the Answer of equation. Which is +5 in decimal .
Binary Subtraction.
Case 2) when first number is smaller than second. (Expected negative answer)
Lets take same e.g. as 1010-1111=? ( i.e. 10-15=? And ans = -5 in decimal)
1010 --- our 1st number
1111 ---- our 2nd number
0000 ---- 1’s complement of 2nd number: and 0000+1 = 0001 is 2’s
complement of 2nd number.
Then add these two numbers.1010+0001=? 1011…again take the 2’s
complement of this product to get the answer which negative.
2’s complement of the 1011= 0100+1= 0101 and its sign is –
So, Answer is – 0101 ( -5 in Decimal)
Binary Multiplication
Binary Multiplication
The multiplication of binary numbers is carried out similar to decimal by
multiplying multiplicand with one bit of multiplier at a time. And add the
products.
Binary Multiplication follows general principal of Shift and ADD.
Binary Multiplication
The rules of binary multiplication.
Case AxB Multiplication
1 0x0 0
2 0x1 0
3 1x0 0
4 1 x1 1
Binary Multiplication
E.g. 1010 x 1011=?
1 0 1 0 Multiplicand
1 0 1 1 multiplier
1 0 1 0 Partial product 1
+ 1 0 1 0 Partial product 2
+ 0 0 0 0 Partial product 3
+ 1 0 1 0 Partial product 4
1 1 0 1 1 1 0 -- Multiplication Answer
Binary Multiplication
E.g. 2 Simple example 4 x 5=? (20) in Binary 100 x 101=?
1 0 0
x 1 0 1
1 0 0
+ 0 0 0
+ 1 0 0
1 0 1 0 0
Binary Division
Binary Division: Division in binary is same as in decimal.
But, in case binary numbers, the quotient should be either 1 or 0 depending
upon diviser.
Binary Division
E.g.
11010÷101=?
101 11010 101 Quotient
- 101
110
-101
1 reminder
Summary
A set of values used to represent different quantities is known as Number
System.
Types of Number Systems.
Binary: Base 2; only 2 bits are used i.e. 1’s and 0’s. it is electronic signals so
computers are used binary system.
Decimal: Base= 10; used 0 to 9 as 10 digits to form a number. Use din day to
day calculations Universal system. Easy to use and understand.
Octal : has base 8 ; used 0 to 7 8 Digits.
Hexadecimal: base 16 ; uses 0 to9 digits and Ato F alphabets where A , B ,C
means 10,11,12, respectively.
After that, we learnt to Convert the numbers as.
Conversions of Decimal to binary, Binary to Decimal .
Conversions of Octal to Binary, Binary to Octal.
Conversions of Hexadecimal to Binary, Binary to Hexadecimal.
Binary Addition,
Binary Subtraction with one’s complement ; Two’s Complement method,
Binary Multiplication, and Binary Division