Page 280 - FUNDAMENTALS OF COMPUTER
P. 280
NPP
280 Fundamentals of Computers NPP
Direct Method of getting 2’s complement 2’s H$m°påßb_|Q> {ZH$mbZo H$s grYr {d{Y
Start from right side (LSB), write all the Xr JB© ~mBZar g§»`m Ho$ grYo hmW H$s Va\$ go ewê$
zeros and first 1. Invert all the remaining bits. H$amo& gmao eyÝ` d àW_ 1 H$mo d¡go hr CVma bmo Ÿ& BgHo$
The resulting binary number is the 2’s comple- níMmV² g^r {~Q>m| H$mo CëQ>m H$a Xmo Ÿ& O¡go _mZm {H$ h_|
ment. Consider the binary number shown in
the above problem i.e 1110, the 2’s complement 1110 H$m 2’s H$m°påßb_|Q> {ZH$mbVm h¡ Vmo ZrMo {MÌ H$mo
can be directly obtained as follows: XoImo…
1 1 1 0 ← Start
↓ ↓↓ ↓
2's complement → 0 0 1 0
Invert
Thus, 0010 is 2’s complement of 1110. AV… 1110 H$m 2’s H$m°påßb_|Q> 0010 h¡ Ÿ&
Problem 3.80 àíZ 3.80
Find 2’s complement of the following num- grYr {d{Y go {ZåZ ~mBZar g§»`mAm| Ho$ 2’s
bers using direct method:
H$m°påßb_|Q> {ZH$mbmo…
(1) 1010 (2) 110100 (3) 11111 (4) 10000 (5) 0001
Solution: hc:
Start from right side and write all the zeros grYo hmW go ewê$ H$aHo$ àW_ 1 VH$ d¡go hr {bImo
and first one. After that take complement of VWm BgHo$ níMmV² gmar {~Q>m| H$mo CëQ>m H$amo…
each bit.
(1) 1010 2’S complement 0110
→
→
(2) 110100 2’S complement 001100
→
→
(3) 11111 2’S complement 00001
→
→
(4) 10000 2’S complement 10000
→
→
(5) 0001 2’S complement 1111
→
→
2’s Complement Subtraction Method 2’s H$m°påßb_|Q> H$s ghm`Vm go KQ>mZm ({~Zm {MÝh
(Unsigned Binary) dmbr g§»`mE±)
Take the 2’s complement of subtrahend and Bg {d{Y _| {Og g§»`m H$mo KQ>mZm h¡ CgH$m 2’s
perform addition instead of subtraction. The H$m°påßb_|Q> bo boVo h¡ Am¡a KQ>mZo Ho$ ~OmE Omo‹S>Vo h¢ Ÿ&
algorithm for 2’s complement subtraction Bg {d{Y H$mo Bg àH$ma g_Pm`m Om gH$Vm h¡…
method is shown below:
1. Take 2’s complement of subtrahend. Re- 1. {Og g§»`m H$mo KQ>mZm h¡, CgH$m 2’s H$m°påßb_|Q> bmo
place (–) sign with (+) and add. VWm (-) Ho$ ñWmZ na (+) {bI Xmo Am¡a Omo‹S>moŸ&

