Function to find the given number is a power of 2 or not?
Answer Posted / sivaraj
Answer 2 Ms is correct and more efficient.
because if a number is power 2 it is in form
1000---->8
100----->4
10------>2 like form
subtract one from that and do with bitwise and it should be
zero.
ie 1000(8) & 0111(7)== 0
| Is This Answer Correct ? | 55 Yes | 2 No |
Post New Answer View All Answers
What does struct node * mean?
What is n in c?
What are the 5 organizational structures?
What is the use of typedef in structure in c?
What's the difference between constant char *p and char * constant p?
How many keywords (reserve words) are in c?
Which header file should you include if you are to develop a function which can accept variable number of arguments?
Define VARIABLE?
What does the error message "DGROUP exceeds 64K" mean?
What is memcpy() function?
how to make a scientific calculater ?
What does & mean in scanf?
What is a floating point in c?
How does #define work?
How can I remove the leading spaces from a string?