# Need Help about range of numbers?

Discussion in 'Programmer's Corner' started by JahanzaibNiazi, Jan 5, 2013.

1. ### JahanzaibNiazi Thread Starter New Member

Jan 5, 2013
1
0
Give range of following numbers that could be stored in 9-bit space?
(a). Unsigned Numbers.
(b).Positive numbers.
(c).Negative Numbers.

Kindly give me the reply i will be thankful to you.......

2. ### Ian Rogers Active Member

Dec 12, 2012
392
95
2 to the power of 9 = 512 possible iterations...

I'm sure you can do the rest...

Last edited: Jan 5, 2013
3. ### djsfantasi AAC Fanatic!

Apr 11, 2010
3,502
1,266
Think first about part a. Lets try a thought experiment. How many numbers can you represent with 1 bit? How about 2 bits? Or 3 bits? From here, you can probably figure out how many unsigned numbers can be represented with 9 bits, or even generalize YOUR solution to 'n' bits. Once this exercise is completed, and knowing how signed numbers are represented in binary, you can try parts b and c.

4. ### MrChips Moderator

Oct 2, 2009
16,737
5,132
Try to work through the answers for (a), (b) and (c) on your own. What are the answers for 2 bits, 3 bits and 4 bits?

From there it will be easy to work out the answers for any number of bits, as djsfantasi says.

The general rule on this forum is not to give you the answer immediately but to encourage you to do the thinking for yourself.