in reply to Decimal to Binary using Bitwise and operator

This is not a homework site and we will not solve your homework problems for you.

If you show us the code you've already written, and tell us what problems you encounter with it, we will gladly assist you in understanding where your code goes wrong and how to fix it. But we will not write complete programs for you.

As for the exercise at hand, I'm pretty confident that all you need to solve the exercise is covered in the chapters leading up to and the chapter actually posing the problem, so you will just have to revisit these to solve the exercise.

As a starting point, consider the case of displaying a whole number between 0 and 1 (inclusive) in binary. As a second step, expand this to displaying a whole number between 0 and 3 in binary. It should be easy to expand your solution to any decimal number range.

  • Comment on Re: Decimal to Binary using Bitwise and operator

Replies are listed 'Best First'.
Re^2: Decimal to Binary using Bitwise and operator
by AchyuthaRao (Initiate) on Jul 15, 2009 at 20:49 UTC
    Thanks for the info, Corion!