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 #define?
What are the 4 data types?
Why pointers are used in c?
Which is better between malloc and calloc?
Write a program to find the biggest number of three numbers in c?
Why do we use return in c?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
Explain the difference between ++u and u++?
What is the function of multilevel pointer in c?
What is meant by keywords in c?
How does normalization of huge pointer works?
can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
given post order,in order construct the corresponding binary tree
Is c call by value?