Function to find the given number is a power of 2 or not?
Answer Posted / jessu srikanth
int isPowerOf2(unsigned int n)
{
float r=n;
while(r>1) r/=2.0;
return (r==1)?1:0; /* 1-> TRUE; 0-> FALSE*/
}
| Is This Answer Correct ? | 9 Yes | 12 No |
Post New Answer View All Answers
Explain b+ tree?
What is function in c with example?
In which layer of the network datastructure format change is done
How can I pad a string to a known length?
What are pragmas and what are they good for?
What is meant by high-order and low-order bytes?
How can I swap two values without using a temporary?
Explain the difference between exit() and _exit() function?
Is void a keyword in c?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
What is sizeof return in c?
What are void pointers in c?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
How can I avoid the abort, retry, fail messages?
What will be the outcome of the following conditional statement if the value of variable s is 10?