Perform the following operations by converting the operands
Solution
(a)
13 will be represented in normal binary form but to perform the subtraction 13-2 it will be treated as 13+(-2)
where 2\'s complement of 2 will be added to binary 13.
For finding 2\'s complement of two first we will complement the binary equivalent of 2 and then add 1 to it, as
-2=NOT(0000 0000 0000 0010)+1=1111 1111 1111 1101+1=1111 1111 1111 1110
Now performing 13+(-2) as
0000 0000 0000 1101(13)
+ 1111 1111 1111 1110(-2)
----------------------------------------
0000 0000 0000 1011 (11)
The decimal value of the result is 11
(b) Similarly here after finding 2\'s complement of 6 we\'ll add them as 5+(-6), i.e.
0000 0000 0000 0101(5)
+ 1111 1111 1111 1010(-6)
--------------------------------------
1111 1111 1111 1111(-1)
The decimal value of the result is -1
(c)-7-(-7) can be written as -7+(-(-7))=-7+7
1111 1111 1111 1001(-7)
+ 0000 0000 0000 0111(7)
-----------------------------------------
0000 0000 0000 0000(0)
The decimal value of the result is 0.
