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.
In reply to Re: Decimal to Binary using Bitwise and operator
by Corion
in thread Decimal to Binary using Bitwise and operator
by AchyuthaRao
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |