Professional Documents
Culture Documents
Lecture No 1 Number Systems and Conversions
Lecture No 1 Number Systems and Conversions
NUMBER SYSTEMS
AND CONVERSIONS
In this lecture…
• Decimal numbering system (Base 10)
• Binary numbering system (Base 2)
• Binary to decimal conversion
• Decimal to binary conversion
• How to write binary sequence?
• Octal numbering system (Base 8)
• Binary to octal conversion
• Decimal to octal conversion
• Octal to decimal conversion
• Hexadecimal number systems
• Binary coded decimal system
• Alphanumerical code
Number Systems
a3a2a1a0.a1a2
a3 r 3 a2 r 2 a1 r1 a0 r 0 a1 r 1 a2 r
2 •The weight of each digit is a POWER of the RADIX
(also called BASE) and is determined by position.
Radix (Base) of a Number
System
• Decimal Number System (Radix = 10)
Eg:- 7392 = 7x103+3x102+9x101+2x100
• 1011.10102
23*1+ 22*0+21*1+20*1. 2-1*1 +2-2*0 +2-3*1 +2-4*0
8 + 0 + 2 + 1.1/2 + 0 + 1/8 + 0
=11.625 Answer
• 11112
23*1 +22*1 +21*1 +20*1
8*1+ 4*1+ 2*1+ 1*1
8+4+2+1=15 Answer
Binary Numbers
• Each binary digit (called bit) is either 1 or 0
• Bits have no inherent meaning, can represent
– Unsigned and signed integers
– Characters
Most Least
– Floating-point numbers Significant Bit Significant Bit
• (10000101)2 =27*1+22*1+2 0 *1
=128+4+1
= 133 Answer
Decimal to binary
conversion
• 12210= (?)2
122
-64 =26
58
- 32 =25
26
16=204
10
- 8= 23
2
- 2= 21
0
(01111010) Answer
Successive division
• Another method to convert decimal into binary is called
successive division.
(1111010) Answer
Successive division
15210= (?)2
Home work: take
2 152 Remainder 0 10 different values in
2 76 Remainder 0 binary and decimal
2 38 Remainder 0 and perform these
2 19 Remainder 1 conversions
2 9 Remainder 1
2 4 Remainder 0
2 2 Remainder 0
(0011000)Answer
Binary sequence
• How to write binary 22=4
00
23=8
000
24=16
0000
sequence? 01
10
001
010
0001
0010
11 011 001
• Formula of counting 00
01
100
101
0100
0101
range 2n=M. 10
11
110
111
0110
0111
00 000 1000
• Where n is the number 01
10
001
010
1001
1010
three (3 bit). 4
5
4
5
6 6
• Weighting factor is power of 7 7
8 10
8. 9 11
10 12
• The range is from 0 to 7. . .
. .
19 17
20 ?
Examples: Binary to octal
conversion:
Convert 011.101 to octal.
0*22+1*21+1*20.1*22+0*21+1*20
(3.5)8 Answer
8 Remainder 1
8 266 Remainder 2
177
8 22 Remainder 6 8 33 Remainder 1
8 2 Remainder 2 8 4 Remainder 4
(261)8Answer (412)8Answer
Convert 404 to
octal.
8 404 Remainder 4
8 50 Remainder 2
8 6 Remainder 6
(624)8Answer
Hexadecimal numbering
s–yTshtee hmex adecimal Decimal Hexadecimal
system is like the octal system, is O O
numbering
the method of grouping bit to 1 1
2 2
simplify entering and reading the 3
4
3
4
1 B
– Weighting factor is power of 16 1
1 C
2
– The range is from o to F. 1
3
D
1 E
– Represent as 6H, 616. 4
1 F
5
– One hexadecimal digit=4 binary
bits.
Hexadecimal conversions
• Convert 001010101 into (?)16
0001 0101 0100
155HAnswer
• Hexadecimal to decimal
i) 2A616 = (?)10
2*162+10*161+6*160
512+160+6
67810Answer
1BC216= (?)10
ii) 1*163+11*162+12*161 2*160
+
4096+2816+192+2
710610Answer
Convert decimal to
hexadecimal
• 15110 to hexadecimal
1*162+5*161+1*160
256+80+1
337HAnswer.
16 214 Remainder 6
16 13 Remainder 13
(D6)16Answer
Binary coded decimal
system:
• A group of binary 0’s and 1’s can be thought of as a code of
representation the decimal number when a decimal number
is represented by its equivalent binary number w call it
straight binary coding.
999
1001
1001
1001
100110011001 BCD
Decimal Binary Octal Hexadecimal BCD
0 0000 0 0 0000
1 0001 1 1 0001
2 0010 2 2 0010
3 0011 3 3 0011
4 0100 4 4 0100
5 0101 5 5 0101
6 0110 6 6 0110
7 0111 7 7 0111
8 1000 10 8 1000
9 1001 11 9 1001
10 1010 12 A 1010
11 1011 13 B 1011
12 1100 14 C 1100
13 1101 15 D 1101
14 1110 16 E 1110
15 1111 17 F 1111