O yes, thanx sukran :) I forgot that.
Sanju :) On Sat, Aug 20, 2011 at 3:46 AM, sukran dhawan <sukrandha...@gmail.com>wrote: > one more condition is required > > if(num != 0 && !( num & (num-1)) > > On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal <srn...@gmail.com> wrote: > >> if(!(x & x-1)) printf("No. is power of 2"); >> >> >> Sanju >> :) >> >> >> >> On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav < >> algowithabhis...@gmail.com> wrote: >> >>> Give a one-line C expression to test whether a number is a power of 2. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.