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
How can I write functions that take a variable number of arguments?
Write a program to show the change in position of a cursor using c
What header files do I need in order to define the standard library functions I use?
Explain the array representation of a binary tree in C.
Do variables need to be initialized?
how many errors in c explain deply
Why do some versions of toupper act strangely if given an upper-case letter?
What is the right way to use errno?
shorting algorithmS
What is the purpose of sprintf?
What does void main return?
find out largest elemant of diagonalmatrix
What is assert and when would I use it?
What are examples of structures?
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon