Week 6 Lecture 11 (Delivered)
Week 6 Lecture 11 (Delivered)
Learning
Objectives
In this chapter you will learn about:
State
Bulb
Switch
Circuit
Pulse
Binary Arithmetic
Binary Addition
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0 plus a carry of 1 to next higher column
Solution
Binary Decimal
carry 11 carry 1
10011 19
+1001 +9
11100 28
In this example, carry are generated for first and second columns
Example
Solution
The addition of three 1s
Binary Decimal can be broken up into two
steps. First, we add only
carry 11111 carr 1 two 1s giving 10 (1 + 1 =
y 10). The third 1 is now
added to this result to
100111 39
obtain 11 (a 1 sum with a 1
+11011 +27 carry). Hence, 1 + 1 + 1 =
1000010 66 1, plus a carry of 1 to next
higher column.
Binary Subtraction
0 - 0 = 0
0 - 1 = 1 with a borrow from the next column
1 - 0 = 1
1 - 1 = 0
Example
Solution
12
0202
10101
-01110
00111
Complement of a Number
Number of digits
in the number
C = Bn
- 1 - N
Example
Solution
Example
Find the complement of 68
Solution
Since number has 1 digit and the value
of
the base
(Base)n - 1 = 81 - 1 = 710 = 78
is 8, Now 78 - 68 = 18
Hence, complement of 68 = 18
Complement of a Binary
Number
Complement of a binary number can be obtained
by transforming all its 0’s to 1’s and all its 1’s to 0’s
Example
Complement of 1 0 1 1 0 1 0 is
1
Ref Page 53 Chapter 5: Computer Arithmetic Slide 15/29
0
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Complementary Method of
Subtraction
Involves following 3 steps:
Example:
Subtract 5610 from 9210 using complementary method.
Solution
Step 1: Complement of 5610
= 102 - 1 - 56 = 99 – 56 The result may be
= 4310 verified using the
method of
Step 2: 92 + 43 (complement of 56) normal
= 135 (note 1 as carry) subtraction:
Step 3: 35 + 1 (add 1 carry to sum) 92 - 56 = 36
Result = 36
Example
Subtract 3510 from 1810 using complementary method.
Solution
18 - 35 = -17
Example
Subtract 01110002 (5610) from 10111002 (9210) using
complementary method.
Solution
1011100
+1000111 (complement of 0111000)
10100011
0100100
Example
Subtract 1000112 (3510) from 0100102 (1810) using
complementary method.
Solution
010010
+011100 (complement of 100011)
101110