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 variable and explain rules to declare variable in c?
how to construct a simulator keeping the logical boolean gates in c
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
What is pointer in c?
Where are local variables stored in c?
What is queue in c?
How can this be legal c?
What is c preprocessor mean?
Find MAXIMUM of three distinct integers using a single C statement
What is a built-in function in C?
What are the different types of control structures in programming?
i have a written test for microland please give me test pattern
What do you understand by friend-functions? How are they used?
What is c method?