How many bits do I need to store an integer that could have
How many bits do I need to store an integer that could have any value in the range [0,3000]?
Solution
Ans:12 bit is required to hold decimal value between 0 to 3000
as we know 10 bits can hold value upto 1024 , 210 = 1024 , single bit can have value either 0 or 1.
211 = 2048 <3000
212 = 3072 >3000
However in C we have integer of 2 bytes i.e 16 bits that hold value from 0 - 65535.
Thanks
![How many bits do I need to store an integer that could have any value in the range [0,3000]?SolutionAns:12 bit is required to hold decimal value between 0 to 30 How many bits do I need to store an integer that could have any value in the range [0,3000]?SolutionAns:12 bit is required to hold decimal value between 0 to 30](/WebImages/39/how-many-bits-do-i-need-to-store-an-integer-that-could-have-1120120-1761595903-0.webp)
