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 const keyword in c?
What is a function simple definition?
Write a program to print fibonacci series using recursion?
explain what are pointers?
Explain what is the general form of a c program?
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
What is the size of empty structure in c?
How are strings stored in c?
What is the use of linkage in c language?
Can you subtract pointers from each other? Why would you?
List the difference between a 'copy constructor' and a 'assignment operator' in C?
What are the advantages and disadvantages of pointers?
What is I ++ in c programming?
What are the differences between Structures and Arrays?
what do you mean by enumeration constant?