76.6k views
3 votes
A computer program uses 4 bits to represent integers when the program adds the decimal numbers 5 and 11 the result is 0 why?

User Sarbo
by
5.3k points

1 Answer

5 votes

Answer:

Because the answer would be 16 which is 10000 in binary, and the 1 drops off because there are only 4 bits for the answer.

Step-by-step explanation:

All calculations will be modulo 2^bits.

So 4 bit storage: calculations modulo 2^4=16

16 modulo 16 is 0.

17 modulo 16 is 1. etc., it wraps around after 15.

User Jason Stewart
by
4.9k points