SlideShare a Scribd company logo
2
Most read
4
Most read
15
Most read
1
SWETA KUMARI BARNWAL
NUMBER SYSTEM
The language we use to communicate with each other is comprised of words and characters.
We understand numbers, characters and words. But this type of data is not suitable for
computers. Computers only understand the numbers.
So, when we enter data, the data is converted into electronic pulse. Each pulse is identified as
code and the code is converted into numeric format by ASCII. It gives each number, character
and symbol a numeric value (number) that a computer understands. So, to understand the
language of computers, one must be familiar with the number systems.
The Number Systems used in computers are:
o Binary number system
o Octal number system
o Decimal number system
o Hexadecimal number system
BASE/RADIX: The base value in a numbering system.
For example,
• In the decimal numbering system, the radix is 10.
• In the hexadecimal numbering system, the radix is 16.
• In the octal numbering system, the radix is 8.
• In the binary numbering system, the radix is 2.
Decimal (10 Symbols)
(0, 1, 2, 3…9)
Octal (8 )
(0, 1, 2, 3…7)
HexaDecimal (16 Symbols)
(0, 1, 2, 3…9, A,B,C,D,E,F)
Binary (2 Symbols)
(0 & 1)
Number System
2
SWETA KUMARI BARNWAL
Bits & Bytes:
• a "bit" is atomic: the smallest unit of storage
• A bit store just a 0 or 1
• "In the computer it's all 0's and 1's" ... bits
• Anything with two separate states can store 1 bit
• In a chip: electric charge = 0/1
• In a hard drive: spots of North/South magnetism = 0/1
• A bit is too small to be much use
• Group of 8 bits together to make 1 byte
• Everything in a computer is 0's and 1's. The bit stores just a 0 or 1: it's the smallest
building block of storage.
ASCII (American Standard Code for Information Interchange)
• ASCII is an encoding representing each typed character by a number
• Each number is stored in one byte (so the number is in 0 to 255)
• A is 65
• B is 66
• a is 96
• space is 32
ASCII stands for the "American Standard Code for Information Interchange".
It was designed in the early 60's, as a standard character set for computers and electronic
devices.
ASCII is a 7-bit character set containing 128 characters.
It contains the numbers from 0-9, the upper- and lower-case English letters from A to Z, and
some special characters.
The character sets used in modern computers, in HTML, and on the Internet, are all based on
ASCII.
The following tables list the 128 ASCII characters and their equivalent number.
3
SWETA KUMARI BARNWAL
4
SWETA KUMARI BARNWAL
Decimal to Binary
(951.205)10 →
(951.205)10 → (1110110111.0011)2
Binary to Decimal
(110101.110)2 → ( )10
5
SWETA KUMARI BARNWAL
(110101.110)2 → (53.75)10
Decimal to Octal
(98.56)10 → (142.4365)8
Octal to Decimal
(41.56)8 → ( 33.7187)10
6
SWETA KUMARI BARNWAL
Decimal to Hexadecimal
(935.126)10 → (3A7.204F)16
Hexadecimal to Decimal
(3A7.204F)16 → (935.1261)10
(2) (1) (0) (-1) (-2) (-3) (-4)  Position
3 A 7 . 2 0 4 F
x x x x x x x
162 161 160 16-1 16-2 16-3 16-4
768 + 160 + 7 . (.125) + (0) + (0.0009)+(0.0002)
7
SWETA KUMARI BARNWAL
Binary to/from Octal
a) Binary → Decimal → Octal
(1010101)2 → (85)10 → (125)8
(110011.110) → (51.75) → (63.6)
b) Octal → Decimal → Binary
(125) → (85) → (1010101) (1010101)
(721.25) → (465.3281) → (111010001.0101)
If no of bits = n
Number represented by that bits (N) = 2n
– 1
Ex:
Octal System (8 symbols: 0 to 7)
N = 7
N = 2n
– 1 = 7
n = 3
When we will convert Octal to Binary, we have required 3 bits for 1
digit.
Decimal to Binary
Binary to Decimal
2(n-1)
……… 22
21
20
32 16 8 4 2 1
No ABC

4 2 1
0 0 0 0
8
SWETA KUMARI BARNWAL
1 0 0 1
2 0 1 0
3 0 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
(125)8 = (001 010 101) (1010101)
721.25 → (111 010 001. 010 101)
(110 011 . 110) → 63.6
(001 110 010 101 . 110 100)2 → (1625.64)
(56.54) → (000056.540000) (5600.00054)
Exercise: Octal to Binary
(128.777)
(765.154)
(5564.721)
(254.631)
(435.61)
Exercise: Binary to Octal
(110111011.111101)
(101110100.011101)
(11100011.010101)
(1010101010.1101001)
9
SWETA KUMARI BARNWAL
Hexadecimal to/from Binary
a) Hexadecimal → Decimal → Binary
(A5.9D) → (165.6132) → (10100101.1001)
(FB1.C4) → (4017.7656) → (111110110001.1100)
b) Binary → Decimal → Hexadecimal
(11110011010.10110) → (1946.6875) → (79A.B0)
Hexadecimal System (16 symbols: 0 to 9 & A B C D E F)
N = 15
N = 2n
– 1 = 15
n = 4
When we will convert Octal to Binary, we have required 3 bits for 1
digit.
Decimal to Binary
Binary to Decimal
2(n-1)
……… 22
21
20
32 16 8 4 2 1
10
SWETA KUMARI BARNWAL
No ABCD

8 4 2 1
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
A 1 0 1 0
B 1 0 1 1
C 1 1 0 0
D 1 1 0 1
E 1 1 1 0
F 1 1 1 1
a) Hexadecimal → Binary
(A5.9D) → (1010 0101 . 1001 1101) → (1010 0101.1001)
(FB1.C4) → (1111 1011 0001 . 1100 0100) → (1111 1011 0001.1100)
(1FB1.C4) → (0001 1111 1011 0001 . 1100 0100)
b) Binary → Hexadecimal
(0111 1001 1010 . 1011 0) → (79A.B0) → (79A.B0)
Q. How many bits are required to represent a number system having 128
symbols? (N 0 to 127)
N = 127
N = 2n
-1
n = 7
11
SWETA KUMARI BARNWAL
Q. How many bits are required to represent a number system having 156
symbols?
N = 155
2n
-1 > = N
n >= 7
n = 8
Q. How many bits are required to represent a number system having 394
symbols?
2n
-1 > = N = 394
Let n = 8, condition is not true
Let n = 9, condition is true
n = 9
Ans.: 9
Q. How many symbols can be represented by using 10 bits?
Ans.: 1024
Q. Find the Maximum Number that can be represented by using 10 bits?
Ans.: 1023
Q. How many symbols can be represented by using 12 bits?
Ans.: 4096
Q. Find the Maximum Number that can be represented by using 9 bits?
Ans.: 511
Q. Hexadecimal to Binary
(BC5.982)
(A712.0056)
(5D8.234)
(98FE.BAF)
12
SWETA KUMARI BARNWAL
Exercise: Binary to Hexadecimal
(110111011.111101)
(101110100.011101)
(11100011.010101)
(1010101010.1101001)
We have already Covered:
Number System & Conversion between
a) Decimal to/from (Binary, Octal & Hexadecimal)
b) Binary to/from Octal & Hexadecimal
OCTAL TO/FROM HEXADECIMAL
Octal → Binary → Hexadecimal
(27.65)8 → (00010 111 . 110 10100) → (17.D4)16
(7765.6271)8 → (111 111 110 101 . 110 010 111 001) → (F F 5. C B 9)
B (11) (8421) (1011)
Hexadecimal → Binary → Octal
(FD90.5C7) → (001111 1101 1001 0000 . 0101 1100 0111) → (176620.2707)8
Ex:
(12FD.97C) (9532.4471) (10DE4.10B) (7AB.F9EB)
(710.554) (5517.346) (7712.354) (1275.2606)
BCD (Binary Coded Decimal)
Another process for converting decimal numbers into their binary equivalents.
• It is a form of binary encoding where each digit in a decimal number is represented
in the form of bits.
• This encoding can be done in either 4-bit or 8-bit (usually 4-bit is preferred).
13
SWETA KUMARI BARNWAL
• It is a fast and efficient system that converts the decimal numbers into binary
numbers as compared to the existing binary system.
• These are generally used in digital displays where is the manipulation of data is
quite a task.
• Thus, BCD plays an important role here because the manipulation is done treating
each digit as a separate single sub-circuit.
In the BCD numbering system, the given decimal number is segregated into chunks of four
bits for each decimal digit within the number. Each decimal digit is converted into its direct
binary form (usually represented in 4-bits).
DECIMAL NUMBER BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
(852.371)10 → (1000 0101 0010 . 0011 0111 0001)BCD
8 → 1000
5 → 0101
2 → 0010
3 → 0011
7 → 0111
1 → 0001
14
SWETA KUMARI BARNWAL
Arithmetic System
a) Addition
1+0 = 1
0+0 = 0
1+1 = 10 → {(1*21
) + (0*20
) = 2}
1+1+1 = 11 → {(1*21
) + (1*20
) = 3}
1+1+1+1 = 100 → {(1*22
) + (0*21
) + (0*20
) = 4}
1100
+1011
10111
11111
+11111
111110
12
12
24
99
99
198
15
SWETA KUMARI BARNWAL
Ex:
1011+1111+1100+1001
1111+1111+1111+1111 = 111100
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
95
98
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
1100+0011
10101111+10001111 = 111111110, 100111110
10101111
10001111
11000011 + 1111100
8 4 2 1
0 1 0→ 2, 011/11 → 3, 100
16
SWETA KUMARI BARNWAL
1+ 1 = 2, 1+1+1 = 3, 1+1+1+1=4
1+1 = 10, 1+1+1 = 11, 1+1+1+1=100
Ex:
a) 1011101110 +1111000110
b) 1111100001+11000110010+10001110101+1011011111=
1000101100111
01111100001
11000110010
10001110101
01011011111
b) Subtraction: (9-5 = 4, 5-9 = -4)
A B Difference Borrow
0 0 0 0
0 1
1 0 1 0
1 1 0 0
4
+5
9
-5
4
1+1 = 10 -1= 1
1+1=2-1=1
1+1=10-1= 1
17
SWETA KUMARI BARNWAL
10
-1
1 1 1 1
1 0 0 1
5000
1925
100 → 4
2n-1
………..21
, 20
11111111100000 → 16352
10000111000011 → 08643
07709
(213
*0)+ (212
*1)+ (211
*1)+ (210
*1)+ (29
*1)+ (28
*0)+
(27
*0)+ (26
*0)+ (25
*0)+ (24
*1)+ (23
*1)+ (22
*1)+
(21
*0)+ (20
*1) =
0+4096+2048+1024+512+0+0+0+16+8+4+0+1=7709
Ex:
a) 110011101 – 100101011
b) 101010101-010101010
c) 111111000-111000111
18
SWETA KUMARI BARNWAL
d) 11001100-10101011
c) Multiplication:
1001
1000
1111
1111 11000001 (11100001)
Ex:
i) 11010*11100
ii) 11101*11111
iii) 111111*101010
iv) 101010*1010101
v) 111111*101
d) Division:
1001/1000
1000
19
SWETA KUMARI BARNWAL
Ex:
i) 11111/1100
ii) 101010/111
iii) 1110011/1010
iv) 1111010/1100
1876→ 10
762 → 8
1011 → 2
98A→ 16
1’s Complement:- A binary no system used to write the -ve no.
Method to write this no.-
transforming the 0 bit to 1 and the 1 bit to 0
Ex:-
1010111110 → 0101000001 = 1111111111
9 → 1001
(-9) → 0110 (in 1’s complement)
129 → 10000001 (2048 1024 512 256 128 64 32 16 8 4 2 1)
Write (-129) → using 1’s complement → 01111110
Write 148 in 1’s complement → (10010100) → 01101011 (-148)
20
SWETA KUMARI BARNWAL
NOTE: If we take complement of any no in two times, then we will get the
original no.
Write in 1’s Complement: (HW)
a) 1110001010 → 0001110101
b) 11111000011
c) 10101010101
d) 1001111000
e) 256 → 011111111 → (100000000)
f) -412 → (412→110011100) → (-412 → 001100011)
g) 98
h) -567
2’s Complement
101010111 → (1’s Complement) 010101000 +1 →(2’s Complement)
010101001
010101001 → 101010110+1 → 101010111
10110110 → 01001001 → 10110110
256 → (100000000) (Binary)
-256 → (011111111) (in 1’s Complement)
-256 → (011111111+1 → 100000000) (in 2’s Complement)
011111111
1
-412 (412→110011100 → Binary) → (-412 → 001100011 → 1’s Complement)
→ (-412 → 001100100 → 2’s complement)
001100100 → 110011011+1 → 110011100
21
SWETA KUMARI BARNWAL
Ex:
a) 298 → 100101010 → (-298 → 011010101 → 1’s) (-298 →
011010110 → 2’s)
b) -298 → 011010110 (011011000)
c) 97
d) -492
e) 187
f) -299
g) 100011101
h) 111001111
i) 100000010
Sign Representation
-355 → (355)
+355 → (355)
(28 → 000011100)
(-28 → 100011100)
28 0
Sign
00011100
(Magnitude
-28 1
Sign
00011100
(Magnitude
(No. of bits: 1, 2, 4, 8, 16…….)
5 (+5) → 0101 → 0 0101
-5 → 0101 (5) → 1 0101
37 → 00100101 (2n
no of bits) 32 16 8 4 2 1
22
SWETA KUMARI BARNWAL
54 → 110110 (00110110) (1101 0110)
129 → 10000001
37 →
0 00100101 000100101
-37 →
1 00100101 100100101
453 → 111000101 → 0000000111000101
0 0000000111000101 00000000111000101
-453
1 0000000111000101 10000000111000101
Ex: (HW)
Write these numbers in 1’s, 2’s Compliment & Sign Representation
a) 137 & -137
b) 98 & -98
c) 266 & -266
d) 32 & -32
e) 78 & -78
The given binary no is in sign representation. Find the magnitude & Sign.
a) 1 1001 = (-9)
23
SWETA KUMARI BARNWAL
b) 0 1101 (+13)
c) 0 00111010 (+58)
d) 1 00111111 (-63)
e) 1 11111111 (-255)
The given binary no (10010) is in sign representation. Find the magnitude
& Sign.
Ans: (-2)
Overflow:
1111
+1111
11110
10111
0111
11110
2n
→ No of symbols
2n
-1 → Maximum no represented by n bits.
n → bits number
n = 1
No of symbols = 21
= 2 ( 0, 1)
Maximum no represented by 1 bits = 21
-1 = 1
n = 2
No of symbols = 22
= 4 ( 00, 01,10, 11)
Maximum no represented by 2 bits = 22
-1 = 3
n = 5
No of symbols = 25
= 32 ( 00000, 00001, 00010……… 11111)
Maximum no represented by 5 bits = 25
-1 = 31

More Related Content

PPTX
Binary number system
PPTX
Number system
PDF
Binary codes
PPTX
Binary codes
PPTX
Number system in Digital Electronics
PPT
Hexadecimal numbers
PPT
Digital logic design part1
PPT
Number system
Binary number system
Number system
Binary codes
Binary codes
Number system in Digital Electronics
Hexadecimal numbers
Digital logic design part1
Number system

What's hot (20)

PPTX
SOP POS, Minterm and Maxterm
PPT
Bus system using Multiplexer in COA .ppt
PPTX
Number System | Types of Number System | Binary Number System | Octal Number ...
PPTX
Arithmetic logic units
PPT
Number system
PPTX
Binary number ppt
PPT
Expression evaluation
PDF
PPTX
Number system....
PPTX
Binary computing
PPTX
Number Systems
PPT
Digital Logic Design
PPTX
Hdlc ppt..
PPTX
Chapter 2.1 introduction to number system
PDF
Binary codes
PPSX
Sequential circuits
PPTX
ADDRESSING MODES
PPTX
Combinational circuit
PPTX
number system
PPTX
Octal COnversion
SOP POS, Minterm and Maxterm
Bus system using Multiplexer in COA .ppt
Number System | Types of Number System | Binary Number System | Octal Number ...
Arithmetic logic units
Number system
Binary number ppt
Expression evaluation
Number system....
Binary computing
Number Systems
Digital Logic Design
Hdlc ppt..
Chapter 2.1 introduction to number system
Binary codes
Sequential circuits
ADDRESSING MODES
Combinational circuit
number system
Octal COnversion
Ad

Similar to Number System.pdf (20)

PDF
Lec 02
PPT
Chapter 3-Data Representation in Computers.ppt
PPT
PPT
PPT
08. Numeral Systems
PPTX
21EC201– Digital Principles and system design.pptx
PPTX
COMPUTER AWARENESS.pptx
PPTX
1.1.1 BINARY SYSTEM
PPT
digitalelectronics.ppt
PPTX
2013 1
PPT
08 Numeral systems
PPT
Number_Systems (2).ppt
PPTX
ARCsxfhcjkvmnfxcgbfgcxhvbxdfzxcgbfxgcvbnx3.pptx
PPT
Cit 1101 lec 02
PPTX
ADE UNIT-III (Digital Fundamentals).pptx
PDF
004 NUMBER SYSTEM (1).pdf
PPT
Number Systems.ppt
PDF
Digital Electronics Notes.pdf
PDF
Digital Electronics – Unit I.pdf
PPT
BEEE - Part B - Unit 3 PPT.ppt DL&CO - Unit 1 PPT.ppt
Lec 02
Chapter 3-Data Representation in Computers.ppt
08. Numeral Systems
21EC201– Digital Principles and system design.pptx
COMPUTER AWARENESS.pptx
1.1.1 BINARY SYSTEM
digitalelectronics.ppt
2013 1
08 Numeral systems
Number_Systems (2).ppt
ARCsxfhcjkvmnfxcgbfgcxhvbxdfzxcgbfxgcvbnx3.pptx
Cit 1101 lec 02
ADE UNIT-III (Digital Fundamentals).pptx
004 NUMBER SYSTEM (1).pdf
Number Systems.ppt
Digital Electronics Notes.pdf
Digital Electronics – Unit I.pdf
BEEE - Part B - Unit 3 PPT.ppt DL&CO - Unit 1 PPT.ppt
Ad

More from Sweta Kumari Barnwal (20)

PDF
UNIT-1 Start Learning R.pdf
PDF
MODULE-2-Cloud Computing.docx.pdf
PDF
Cloud Computing_Module-1.pdf
PDF
Computer Network-Data Link Layer-Module-2.pdf
PDF
Sensors in Different Applications Area.pdf
PDF
Sensor technology module-3-interface electronic circuits
PDF
Sensors fundamentals and characteristics, physical principle of sensing
PDF
Basic computer system
PDF
Features of windows
PDF
Operating system and services
PDF
Introduction to computers
PDF
Application Layer
PDF
Network Layer & Transport Layer
PDF
Module 5-cloud computing-SECURITY IN THE CLOUD
PDF
Module 3-cyber security
PDF
Unit ii-hackers and cyber crimes
PDF
Module 3-cloud computing
PDF
Virtualization - cloud computing
PDF
Process improvement & service oriented software engineering
PDF
Introduction to computers i
UNIT-1 Start Learning R.pdf
MODULE-2-Cloud Computing.docx.pdf
Cloud Computing_Module-1.pdf
Computer Network-Data Link Layer-Module-2.pdf
Sensors in Different Applications Area.pdf
Sensor technology module-3-interface electronic circuits
Sensors fundamentals and characteristics, physical principle of sensing
Basic computer system
Features of windows
Operating system and services
Introduction to computers
Application Layer
Network Layer & Transport Layer
Module 5-cloud computing-SECURITY IN THE CLOUD
Module 3-cyber security
Unit ii-hackers and cyber crimes
Module 3-cloud computing
Virtualization - cloud computing
Process improvement & service oriented software engineering
Introduction to computers i

Recently uploaded (20)

PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Institutional Correction lecture only . . .
PPTX
master seminar digital applications in india
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Business Ethics Teaching Materials for college
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Cell Structure & Organelles in detailed.
PDF
Anesthesia in Laparoscopic Surgery in India
STATICS OF THE RIGID BODIES Hibbelers.pdf
Institutional Correction lecture only . . .
master seminar digital applications in india
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
human mycosis Human fungal infections are called human mycosis..pptx
VCE English Exam - Section C Student Revision Booklet
Business Ethics Teaching Materials for college
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
O7-L3 Supply Chain Operations - ICLT Program
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Complications of Minimal Access Surgery at WLH
Renaissance Architecture: A Journey from Faith to Humanism
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Microbial disease of the cardiovascular and lymphatic systems
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Cell Structure & Organelles in detailed.
Anesthesia in Laparoscopic Surgery in India

Number System.pdf

  • 1. 1 SWETA KUMARI BARNWAL NUMBER SYSTEM The language we use to communicate with each other is comprised of words and characters. We understand numbers, characters and words. But this type of data is not suitable for computers. Computers only understand the numbers. So, when we enter data, the data is converted into electronic pulse. Each pulse is identified as code and the code is converted into numeric format by ASCII. It gives each number, character and symbol a numeric value (number) that a computer understands. So, to understand the language of computers, one must be familiar with the number systems. The Number Systems used in computers are: o Binary number system o Octal number system o Decimal number system o Hexadecimal number system BASE/RADIX: The base value in a numbering system. For example, • In the decimal numbering system, the radix is 10. • In the hexadecimal numbering system, the radix is 16. • In the octal numbering system, the radix is 8. • In the binary numbering system, the radix is 2. Decimal (10 Symbols) (0, 1, 2, 3…9) Octal (8 ) (0, 1, 2, 3…7) HexaDecimal (16 Symbols) (0, 1, 2, 3…9, A,B,C,D,E,F) Binary (2 Symbols) (0 & 1) Number System
  • 2. 2 SWETA KUMARI BARNWAL Bits & Bytes: • a "bit" is atomic: the smallest unit of storage • A bit store just a 0 or 1 • "In the computer it's all 0's and 1's" ... bits • Anything with two separate states can store 1 bit • In a chip: electric charge = 0/1 • In a hard drive: spots of North/South magnetism = 0/1 • A bit is too small to be much use • Group of 8 bits together to make 1 byte • Everything in a computer is 0's and 1's. The bit stores just a 0 or 1: it's the smallest building block of storage. ASCII (American Standard Code for Information Interchange) • ASCII is an encoding representing each typed character by a number • Each number is stored in one byte (so the number is in 0 to 255) • A is 65 • B is 66 • a is 96 • space is 32 ASCII stands for the "American Standard Code for Information Interchange". It was designed in the early 60's, as a standard character set for computers and electronic devices. ASCII is a 7-bit character set containing 128 characters. It contains the numbers from 0-9, the upper- and lower-case English letters from A to Z, and some special characters. The character sets used in modern computers, in HTML, and on the Internet, are all based on ASCII. The following tables list the 128 ASCII characters and their equivalent number.
  • 4. 4 SWETA KUMARI BARNWAL Decimal to Binary (951.205)10 → (951.205)10 → (1110110111.0011)2 Binary to Decimal (110101.110)2 → ( )10
  • 5. 5 SWETA KUMARI BARNWAL (110101.110)2 → (53.75)10 Decimal to Octal (98.56)10 → (142.4365)8 Octal to Decimal (41.56)8 → ( 33.7187)10
  • 6. 6 SWETA KUMARI BARNWAL Decimal to Hexadecimal (935.126)10 → (3A7.204F)16 Hexadecimal to Decimal (3A7.204F)16 → (935.1261)10 (2) (1) (0) (-1) (-2) (-3) (-4)  Position 3 A 7 . 2 0 4 F x x x x x x x 162 161 160 16-1 16-2 16-3 16-4 768 + 160 + 7 . (.125) + (0) + (0.0009)+(0.0002)
  • 7. 7 SWETA KUMARI BARNWAL Binary to/from Octal a) Binary → Decimal → Octal (1010101)2 → (85)10 → (125)8 (110011.110) → (51.75) → (63.6) b) Octal → Decimal → Binary (125) → (85) → (1010101) (1010101) (721.25) → (465.3281) → (111010001.0101) If no of bits = n Number represented by that bits (N) = 2n – 1 Ex: Octal System (8 symbols: 0 to 7) N = 7 N = 2n – 1 = 7 n = 3 When we will convert Octal to Binary, we have required 3 bits for 1 digit. Decimal to Binary Binary to Decimal 2(n-1) ……… 22 21 20 32 16 8 4 2 1 No ABC  4 2 1 0 0 0 0
  • 8. 8 SWETA KUMARI BARNWAL 1 0 0 1 2 0 1 0 3 0 1 1 4 1 0 0 5 1 0 1 6 1 1 0 7 1 1 1 (125)8 = (001 010 101) (1010101) 721.25 → (111 010 001. 010 101) (110 011 . 110) → 63.6 (001 110 010 101 . 110 100)2 → (1625.64) (56.54) → (000056.540000) (5600.00054) Exercise: Octal to Binary (128.777) (765.154) (5564.721) (254.631) (435.61) Exercise: Binary to Octal (110111011.111101) (101110100.011101) (11100011.010101) (1010101010.1101001)
  • 9. 9 SWETA KUMARI BARNWAL Hexadecimal to/from Binary a) Hexadecimal → Decimal → Binary (A5.9D) → (165.6132) → (10100101.1001) (FB1.C4) → (4017.7656) → (111110110001.1100) b) Binary → Decimal → Hexadecimal (11110011010.10110) → (1946.6875) → (79A.B0) Hexadecimal System (16 symbols: 0 to 9 & A B C D E F) N = 15 N = 2n – 1 = 15 n = 4 When we will convert Octal to Binary, we have required 3 bits for 1 digit. Decimal to Binary Binary to Decimal 2(n-1) ……… 22 21 20 32 16 8 4 2 1
  • 10. 10 SWETA KUMARI BARNWAL No ABCD  8 4 2 1 0 0 0 0 0 1 0 0 0 1 2 0 0 1 0 3 0 0 1 1 4 0 1 0 0 5 0 1 0 1 6 0 1 1 0 7 0 1 1 1 8 1 0 0 0 9 1 0 0 1 A 1 0 1 0 B 1 0 1 1 C 1 1 0 0 D 1 1 0 1 E 1 1 1 0 F 1 1 1 1 a) Hexadecimal → Binary (A5.9D) → (1010 0101 . 1001 1101) → (1010 0101.1001) (FB1.C4) → (1111 1011 0001 . 1100 0100) → (1111 1011 0001.1100) (1FB1.C4) → (0001 1111 1011 0001 . 1100 0100) b) Binary → Hexadecimal (0111 1001 1010 . 1011 0) → (79A.B0) → (79A.B0) Q. How many bits are required to represent a number system having 128 symbols? (N 0 to 127) N = 127 N = 2n -1 n = 7
  • 11. 11 SWETA KUMARI BARNWAL Q. How many bits are required to represent a number system having 156 symbols? N = 155 2n -1 > = N n >= 7 n = 8 Q. How many bits are required to represent a number system having 394 symbols? 2n -1 > = N = 394 Let n = 8, condition is not true Let n = 9, condition is true n = 9 Ans.: 9 Q. How many symbols can be represented by using 10 bits? Ans.: 1024 Q. Find the Maximum Number that can be represented by using 10 bits? Ans.: 1023 Q. How many symbols can be represented by using 12 bits? Ans.: 4096 Q. Find the Maximum Number that can be represented by using 9 bits? Ans.: 511 Q. Hexadecimal to Binary (BC5.982) (A712.0056) (5D8.234) (98FE.BAF)
  • 12. 12 SWETA KUMARI BARNWAL Exercise: Binary to Hexadecimal (110111011.111101) (101110100.011101) (11100011.010101) (1010101010.1101001) We have already Covered: Number System & Conversion between a) Decimal to/from (Binary, Octal & Hexadecimal) b) Binary to/from Octal & Hexadecimal OCTAL TO/FROM HEXADECIMAL Octal → Binary → Hexadecimal (27.65)8 → (00010 111 . 110 10100) → (17.D4)16 (7765.6271)8 → (111 111 110 101 . 110 010 111 001) → (F F 5. C B 9) B (11) (8421) (1011) Hexadecimal → Binary → Octal (FD90.5C7) → (001111 1101 1001 0000 . 0101 1100 0111) → (176620.2707)8 Ex: (12FD.97C) (9532.4471) (10DE4.10B) (7AB.F9EB) (710.554) (5517.346) (7712.354) (1275.2606) BCD (Binary Coded Decimal) Another process for converting decimal numbers into their binary equivalents. • It is a form of binary encoding where each digit in a decimal number is represented in the form of bits. • This encoding can be done in either 4-bit or 8-bit (usually 4-bit is preferred).
  • 13. 13 SWETA KUMARI BARNWAL • It is a fast and efficient system that converts the decimal numbers into binary numbers as compared to the existing binary system. • These are generally used in digital displays where is the manipulation of data is quite a task. • Thus, BCD plays an important role here because the manipulation is done treating each digit as a separate single sub-circuit. In the BCD numbering system, the given decimal number is segregated into chunks of four bits for each decimal digit within the number. Each decimal digit is converted into its direct binary form (usually represented in 4-bits). DECIMAL NUMBER BCD 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 (852.371)10 → (1000 0101 0010 . 0011 0111 0001)BCD 8 → 1000 5 → 0101 2 → 0010 3 → 0011 7 → 0111 1 → 0001
  • 14. 14 SWETA KUMARI BARNWAL Arithmetic System a) Addition 1+0 = 1 0+0 = 0 1+1 = 10 → {(1*21 ) + (0*20 ) = 2} 1+1+1 = 11 → {(1*21 ) + (1*20 ) = 3} 1+1+1+1 = 100 → {(1*22 ) + (0*21 ) + (0*20 ) = 4} 1100 +1011 10111 11111 +11111 111110 12 12 24 99 99 198
  • 15. 15 SWETA KUMARI BARNWAL Ex: 1011+1111+1100+1001 1111+1111+1111+1111 = 111100 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 95 98 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1100+0011 10101111+10001111 = 111111110, 100111110 10101111 10001111 11000011 + 1111100 8 4 2 1 0 1 0→ 2, 011/11 → 3, 100
  • 16. 16 SWETA KUMARI BARNWAL 1+ 1 = 2, 1+1+1 = 3, 1+1+1+1=4 1+1 = 10, 1+1+1 = 11, 1+1+1+1=100 Ex: a) 1011101110 +1111000110 b) 1111100001+11000110010+10001110101+1011011111= 1000101100111 01111100001 11000110010 10001110101 01011011111 b) Subtraction: (9-5 = 4, 5-9 = -4) A B Difference Borrow 0 0 0 0 0 1 1 0 1 0 1 1 0 0 4 +5 9 -5 4 1+1 = 10 -1= 1 1+1=2-1=1 1+1=10-1= 1
  • 17. 17 SWETA KUMARI BARNWAL 10 -1 1 1 1 1 1 0 0 1 5000 1925 100 → 4 2n-1 ………..21 , 20 11111111100000 → 16352 10000111000011 → 08643 07709 (213 *0)+ (212 *1)+ (211 *1)+ (210 *1)+ (29 *1)+ (28 *0)+ (27 *0)+ (26 *0)+ (25 *0)+ (24 *1)+ (23 *1)+ (22 *1)+ (21 *0)+ (20 *1) = 0+4096+2048+1024+512+0+0+0+16+8+4+0+1=7709 Ex: a) 110011101 – 100101011 b) 101010101-010101010 c) 111111000-111000111
  • 18. 18 SWETA KUMARI BARNWAL d) 11001100-10101011 c) Multiplication: 1001 1000 1111 1111 11000001 (11100001) Ex: i) 11010*11100 ii) 11101*11111 iii) 111111*101010 iv) 101010*1010101 v) 111111*101 d) Division: 1001/1000 1000
  • 19. 19 SWETA KUMARI BARNWAL Ex: i) 11111/1100 ii) 101010/111 iii) 1110011/1010 iv) 1111010/1100 1876→ 10 762 → 8 1011 → 2 98A→ 16 1’s Complement:- A binary no system used to write the -ve no. Method to write this no.- transforming the 0 bit to 1 and the 1 bit to 0 Ex:- 1010111110 → 0101000001 = 1111111111 9 → 1001 (-9) → 0110 (in 1’s complement) 129 → 10000001 (2048 1024 512 256 128 64 32 16 8 4 2 1) Write (-129) → using 1’s complement → 01111110 Write 148 in 1’s complement → (10010100) → 01101011 (-148)
  • 20. 20 SWETA KUMARI BARNWAL NOTE: If we take complement of any no in two times, then we will get the original no. Write in 1’s Complement: (HW) a) 1110001010 → 0001110101 b) 11111000011 c) 10101010101 d) 1001111000 e) 256 → 011111111 → (100000000) f) -412 → (412→110011100) → (-412 → 001100011) g) 98 h) -567 2’s Complement 101010111 → (1’s Complement) 010101000 +1 →(2’s Complement) 010101001 010101001 → 101010110+1 → 101010111 10110110 → 01001001 → 10110110 256 → (100000000) (Binary) -256 → (011111111) (in 1’s Complement) -256 → (011111111+1 → 100000000) (in 2’s Complement) 011111111 1 -412 (412→110011100 → Binary) → (-412 → 001100011 → 1’s Complement) → (-412 → 001100100 → 2’s complement) 001100100 → 110011011+1 → 110011100
  • 21. 21 SWETA KUMARI BARNWAL Ex: a) 298 → 100101010 → (-298 → 011010101 → 1’s) (-298 → 011010110 → 2’s) b) -298 → 011010110 (011011000) c) 97 d) -492 e) 187 f) -299 g) 100011101 h) 111001111 i) 100000010 Sign Representation -355 → (355) +355 → (355) (28 → 000011100) (-28 → 100011100) 28 0 Sign 00011100 (Magnitude -28 1 Sign 00011100 (Magnitude (No. of bits: 1, 2, 4, 8, 16…….) 5 (+5) → 0101 → 0 0101 -5 → 0101 (5) → 1 0101 37 → 00100101 (2n no of bits) 32 16 8 4 2 1
  • 22. 22 SWETA KUMARI BARNWAL 54 → 110110 (00110110) (1101 0110) 129 → 10000001 37 → 0 00100101 000100101 -37 → 1 00100101 100100101 453 → 111000101 → 0000000111000101 0 0000000111000101 00000000111000101 -453 1 0000000111000101 10000000111000101 Ex: (HW) Write these numbers in 1’s, 2’s Compliment & Sign Representation a) 137 & -137 b) 98 & -98 c) 266 & -266 d) 32 & -32 e) 78 & -78 The given binary no is in sign representation. Find the magnitude & Sign. a) 1 1001 = (-9)
  • 23. 23 SWETA KUMARI BARNWAL b) 0 1101 (+13) c) 0 00111010 (+58) d) 1 00111111 (-63) e) 1 11111111 (-255) The given binary no (10010) is in sign representation. Find the magnitude & Sign. Ans: (-2) Overflow: 1111 +1111 11110 10111 0111 11110 2n → No of symbols 2n -1 → Maximum no represented by n bits. n → bits number n = 1 No of symbols = 21 = 2 ( 0, 1) Maximum no represented by 1 bits = 21 -1 = 1 n = 2 No of symbols = 22 = 4 ( 00, 01,10, 11) Maximum no represented by 2 bits = 22 -1 = 3 n = 5 No of symbols = 25 = 32 ( 00000, 00001, 00010……… 11111) Maximum no represented by 5 bits = 25 -1 = 31