0% found this document useful (0 votes)
12 views5 pages

2-Addition & Subtraction

Uploaded by

Huma Iqrar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views5 pages

2-Addition & Subtraction

Uploaded by

Huma Iqrar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Addition & Subtraction

One’s Complement
• The one’s complement of an integer is obtained by complementing
each bit, that is, replace each 0 by a 1 and each 1 by a 0.

2
2’s Complement
• Negative integers are stored in computer using 2’s complement.
• To get a two’s complement by first finding the one’s complement, and
then by adding 1 to it.

• Example
11110011 (one's complement of 12)     
+ 00000001 (decimal 1)    
11110100 (two's complement of 12)

3
Subtract

as 2’s Complement Addition
Find the difference of 12 – 5 using complementation
and addition.
• 00000101 (decimal 5)
• 11111011 (2’s Complement of 5)

00001100 (decimal 12)


+ 11111011 (decimal -5)
00000111 (decimal 7)

Carry
discard

4
Example
• Find the difference of 5ABCh – 21FCh using complementation and
addition.
• 5ABCh = 0101 1010 1011 1100
• 21FCh = 0010 0001 1111 1100
• 1101 1110 0000 0100 (2’s Complement of 21FCh)

0101 1010 1011 1100 (Binary 5ABCh)


+ 1101 1110 0000 0100 (2’s Complement of 21FCh)
10011 1000 1100 0000
Discard
Carry 5

You might also like