Function to find the given number is a power of 2 or not?
Answer Posted / abhishek sharma
unsigned int is_power_of_2(unsigned int x)
{
return (x != 0) && ((x & (x - 1)) == 0);
}
| Is This Answer Correct ? | 23 Yes | 3 No |
Post New Answer View All Answers
Why is it that not all header files are declared in every C program?
Explain how do you list a file’s date and time?
What are the types of variables in c?
formula to convert 2500mmh2o into m3/hr
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
Dont ansi function prototypes render lint obsolete?
can any one tel me wt is the question pattern for NIC exam
#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }
What is the difference between printf and scanf in c?
What happens if a header file is included twice?
What is a floating point in c?
What is meant by int main ()?
praagnovation
What is sorting in c plus plus?
Are negative numbers true in c?