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
In a switch statement, explain what will happen if a break statement is omitted?
What is bubble sort in c?
What is malloc calloc and realloc in c?
Can a variable be both static and volatile in c?
What is a nested loop?
write a proram to reverse the string using switch case?
What are the different types of control structures in programming?
What is a method in c?
How do I convert a string to all upper or lower case?
What is the purpose of clrscr () printf () and getch ()?
What is the difference between far and near in c?
What is the size of enum in c?
what do you mean by enumeration constant?
Why does everyone say not to use gets?
Write the Program to reverse a string using pointers.