Find if there is only one bit set in a number

In the bit representation of a number, find if there is exactly one bit that is set.

e.g. your approach should say true for the following numbers :
1,2,4,8,16
and false for the following numbers :
3,5,7,10

0 comments:

Post a Comment

 
Moviehole-madhurtanwani © 2010 | Designed by Chica Blogger | Back to top