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 is difference between union All statement and Union?
Explain what are bus errors, memory faults, and core dumps?
Is r written in c?
How can you access memory located at a certain address?
How do I copy files?
What is meant by operator precedence?
Which control loop is recommended if you have to execute set of statements for fixed number of times?
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
Is exit(status) truly equivalent to returning the same status from main?
Why is c called "mother" language?
What is a constant and types of constants in c?
What is oops c?
What is array of structure in c?
Write a Program to find whether the given number or string is palindrome.
What are lookup tables in c?