Question

Convert the decimal numbers A and B to 5-bit binary numbers. Using two’s complement representation, show...

Convert the decimal numbers A and B to 5-bit binary numbers. Using two’s complement representation,

show (i) how to subtract the two 5-bit binary numbers (A−B);

(ii) how to translate the binary result back to decimal

0 0
Add a comment Improve this question Transcribed image text
Answer #1

To convert a given decimal no, to a 5 bit binary number we have to do divide the given no, by 2 until the remainder is 0

for example lets take 5

-----remainder -----------

2 5
2 2 1
2 1 0
0 1

now read the remainder column in bottom up way

so you will get the order as 0 0 1 0 1 let it be A

similarly for any other number

so lets take another no, as 6

its binary number is 0 0 1 1 0 let it be B

now 5 bit binary subtraction for A-B

first of all u need to do is-

take the negative number and do 1's complement and then add 1 to the obtained result to make it as 2's complement

so ,now do 2's complement on B

step one ----- one's complement on    0 0 1 1 0

gives 1 1 0 0 1

now add 1 to it 1s

1 1 0 1 1 this is the 2s complement of B

now to do A-B  

we got the required format

now add the 2s complement of B and A to get the difference of A-B

carry bit 1 1 1 1 1

A------------ 0 0 1 0 1

B---------- +1 1 0 1 1

0 0 0 0 0 this the final binary number you would obtain

as the carry is 1 this indicates the result is negative and now you have to add that carry (1) to obtained result

then the result is now turns to 0 0 0 0 1 which is the required result .

2) so lets us check the obtained answer - 0 0 0 0 1

as we did 5-6 we get -1

now converting the obtained binary result to decimal number ---

okay lets now convert the result ----------- 1*20+0*21+0*22+0*23+0*24=1+0+0+0+0=1

Add a comment
Know the answer?
Add Answer to:
Convert the decimal numbers A and B to 5-bit binary numbers. Using two’s complement representation, show...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT