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
Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?
What is variables in c?
What is the collection of communication lines and routers called?
How does pointer work in c?
What is int main () in c?
What are the header files used in c language?
Why we use stdio h in c?
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
What should malloc() do?
Explain high-order bytes.
What is the code in while loop that returns the output of given code?
What is a example of a variable?
Can 'this' pointer by used in the constructor?
What is the difference between %d and %i?
Write a C program to count the number of email on text