Obtain the 1s and 2s complements of the following binary num
Obtain the 1\'s and 2\'s complements of the following binary numbers:
(a)00010000
(b)00000000
(c)11011010
(d)10101010
(e)10000101
(f)11111111
Solution
Ans) 1\'s complement is inversion of each bit and 2\'s complement is adding 1 to 1\'s complement and ignore carry or overflow
(a) 00010000-------11101111 (1\'s complement)
1
------------------------------------------------
11110000(2\'s compliment)
----------------------------------------------------------
(b) 00000000-------11111111 (1\'s complement)
1
------------------------------------------------
00000000(2\'s compliment)
---------------------------------------------------------------------------
(c) 11011010-------00100101 (1\'s complement)
1
------------------------------------------------
00100110(2\'s compliment)
---------------------------------------------------------------------------
(d) 10101010-------01010101 (1\'s complement)
1
------------------------------------------------
01010110(2\'s compliment)
-----------------------------------------------------------------------
(e) 10000101-------01111010 (1\'s complement)
1
------------------------------------------------
01111011(2\'s compliment)
----------------------------------------------------------------
(f) 11111111------- 00000000 (1\'s complement)
1
------------------------------------------------
00000001(2\'s compliment)
--------------------------------------------------------

