L-8 Number Systems
L-8 Number Systems
Number Systems
1
W.C. Deshapriya
Learning Outcomes
After completing this lesson, you will be able to Identify the various
type of number systems such as:
• Non-Positional Number System
• Positional Number System
• Number Systems Conversion
• Binary addition and subtraction
2
Number System
• In the computer stores numbers, letters, and other special characters as
in coded form.
• Before going into the details of these codes, it is essential to understand
number system.
• Basically Number systems are two types:
• non-positional and positional.
3
Non-Positional Number System
• In the normal counting, peoples are using an additive approach or non-
positional number system.
• we have symbols such as I for 1, II for 2, III for 3, IIII for 4, IIII for 5, etc.
• Each symbol represents the same value regardless of its position in a
number.
• I-1 II-2 III-3 IIII-4 IIII -5
4
Positional Number System
In a positional number system, there are only a few symbols called digits. These
symbols represent different values, depending on the position they occupy in a
number.
5
N base - Number system
• Number of N Digits are there : 0, 1, 2, 3, 4, 5, …, N-1
• It is positional Number System
6
Decimal number system
Base is equal to 10 because there are altogether ten digits from 0
to 9. Base=10; No of symbols=10 (0,1,…,9)
7
Binary number system
Binary number system is base on 2, instead of 1,0.
We can use only two digits (0 and 1) in this Binary system.
Ex: 101012
= 1 0 1 0 1
= (1 x 24) + (0 x 23) + (1 x 22) + (0 x 21) + (1 x 20)
8
Octal number system
In octal number system, the base is 8, there are only 8 digits from 0 to 7
(0,1,2,3,4,5,6, and 7)
Ex: 20578
= 2 0 5 7
= (2 x 83) + (0 x 82) + (5 x 81) + (7 x 80)
9
Hexadecimal number system
Ex: 2AF16 = 2 A F
= (2 x 162) + (A x 161) + (F x 160)
10
Summery of number system
11
Number Systems Conversion
• Numbers expressed in decimal number system are much more
meaningful to us,
• But the computer work with binary number system.
• The programmers are use Hexadecimal number system to for
the programming.
12
Convert from another Base to Decimal
Step 1: Determine the column (position) value of each digits.
(this depends on the position of the digit and the base of the number
system).
Step 3 : Get sum of the products calculated in Step 2. The total is the
equivalent value in decimal.
13
Binary to Decimal Conversion
Ex1: 110012 = ?10 1 1 0 0 1
4 3 2 1 0
Step 1: Determine Column values.
16 8 4 2 1
16 + 8 + 0 + 0 + 1
2510 14
Binary to Decimal
Ex2: 1010.012 = ?10
= 1 0 1 0 . 0 1
= (1 x 23) + (0 x 22) + (1 x 21) + (0 x 20) . (0 x 2-1) + (1 x 2-2)
= (1 x 8) + (0 x 4) + (1 x 2) + (0 x 1) . (0 x 1/2) + (1 x 1/4)
= 8 + 0 + 2 + 0 . (0) + (0.25)
= 10.2510
15
Activity 1: Convert these binary numbers to the decimal number system
1. 10011
2. 1101.01
3. 011.11
4. 1010.101
5. 101010.01
16
Octal to Decimal Conversion
57068 = ?10
5 7 0 6
3 2 1 0
Step 1: Determine Column values.
83 82 81 80
Step 2: Multiply the column values by the
512 64 8 1
corresponding column digits. x5 x7 x0 x6
2560 448 0 6
17
Activity 2 : Convert these octal number to decimal number system
1. 12348
2. 35628
3. 01028
4. 156318
5. 101248
18
Hexadecimal to Decimal Conversion
52A16 = ?10
5 2 A
2 1 0
Step 1: Determine Column values.
162 161 160
Step 2: Multiply the column values by 256 16 1
the corresponding column digits.
x3 x2 xA
1280 32 10
Step 3: Sum up the products. 1280+ 32+10
132210
19
Activity 3 : Convert these hexadecimal number to decimal
number system
1. 19A3B16
2. 397B216
3. C19216
4. 1E9F116
5. AC1B416
20
Decimal to Binary Conversion
Repeatedly divide the number by 2 and note any remainder
4210 = ?2
21
Decimal to Binary Conversion
34.687510 = ?2
22
Decimal to Binary Conversion
34.687510 = ?2
23
Decimal to Binary Conversion
34.687510 = ?2
24
Activity 4 : Convert given decimal number to binary number system
1. 125.310
2. 39.5210
3. 19.2910
4. 193.110
5. 11.0110
25
Decimal to octal Conversion
Repeatedly divide the number by 8 and note any remainder
95210 = ?8
26
Activity 5 : Convert given decimal numbers to octal number system
1. 12310
2. 95210
3. 19210
4. 193110
5. 10110
27
Decimal to hexadecimal Conversion
Repeatedly divide the number by 16 and note any remainder
42810 = ?16
28
Activity 6 : Convert given decimal number to hexadecimal
number system
1. 125310
2. 395210
3. 19210
4. 193110
5. 10110
29
Octal to binary Conversion
4538 = ?2 Base 82 Max 78 1112
Min 08 0002
4538 4 5 3
100 101 011
100 101 0112
= 1001010112
30
Activity 7 : Convert these octal number to binary number system
1. 1018
2. 1628
3. 12538
4. 37528
5. 16318
31
Binary to octal Conversion
2 1 0
10101112 = ?8 Base 28 22 + 21 + 20
4 2 1
1,010,1112 001 010 111
Max 1112 78
1 2 7
Min 0002 08
1278
0010101112 = 1278
32
Activity 8 : Convert these binary number to octal number system
1. 1012
2. 1012
3. 101012
4. 1010102
5. 10001102
6. 10012
33
Hexadecimal to binary Conversion
4E316 = ?2 Base 162 23 + 22 + 21 + 20
8 4 2 1
4 E (14) 3
Max 1516 11112
0100 1110 0011
Min 016 00002
0100 1110 00112 3 2 1
1x2 + 1x2 + 1x2 + 1x2
0
8+ 4 + 2 + 1
0,1,…9 – 10->A, 11-> B 15-> F
34
Activity 9 : Convert these hexadecimal number to binary number system
1. 19A3B16
2. 397B216
3. C19216
4. 1E9B3116
5. 1AC1B416
35
Binary to hexadecimal Conversion
8 4 2 1
10110112 = ?16 Base 216 23 + 22 + 21 + 20
10101112 = 5B16
1x 8 +1x4 + 1x2 + 1x1
8+ 4 + 2 + 1
36
Activity 10 : Convert these binary number to hexadecimal number
system
1. 100112
2. 101012
3. 1010012
4. 1010102
5. 10001102
37
Binary Addition & subtraction
38
Binary Addition
39
Binary Addition
Multiple Bit Addition
11
10110
10011 +
101001
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 40
Binary Addition
111
11110
10111 +
110101 2 1 0
3 1 1
41
Activity 11 : Multiple Bit Addition
1. 10101+1010
2. 101010+ 100110
3. 1001+ 101
4. 1010+10
5. 1011+11101
42
Binary subtraction
Work the columns right to left subtracting in each column. If you must
subtract a one from a zero, you need to “borrow” from the left, just as in
decimal subtraction
43
Ones’ Complements
• 1’s complement (or Ones’ Complement)
To calculate the 1’s complement of a binary number just “inverting” each bit
of the original binary number.
E.g. 0 1 , 1 0
01010100100 10101011011
44
1’s Complements
• An N-bit ones' complement number system can only represent integers in the
range of positive and negative.
45
Activity 12 : Calculate the one’s complement of given binary
1. 10101
2. 10101000110
3. 10010101
4. 101010
5. 1011110
46
Twos’ Complements
• 2’s complement (or Twos’ Complement)
01010100100
10101011011 (one’s complement)
10101011011 + 1
10101011100 (Twos’ Complement)
47
Twos’ Complements
48
Activity 12 : Calculate the 2’s complement of given binary
1. 10101
2. 101010110
3. 10010101
4. 101010
5. 1011110
49
Thanks!
50