Computer Science, asked by TbiaSamishta, 1 year ago

Ankita takes as input 2 integer numbers, a and b, whose value can be between 0 and 31. He stores them as 5 bit numbers. He writes the following code to process 9 these numbers to produce a third number c. c = 2*(a - b) In how many minimum bits should Ankita store c? Op 1: 6 bits Op 2: 7 bits Op 3: 8 bits Op 4: 9 bits Op 5:

Answers

Answered by aqibkincsem
27

Ankita can use the option 2 and that is 7 bits. If two numbers are taken like number a, 11100 (28) and number b, 11101 (29). a-b implies subtracting 29 from 28 and it results in -1 or -00001.

We need an extra bit to store the sign. We are using a minimum of 6 bits. 2(a-b)=-00010 (-00001x2). This process required the carry bit. We are using minimum of 5+2=7 bits.

Similar questions