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
Do you know the difference between exit() and _exit() function in c?
What is meant by gets in c?
Why clrscr is used in c?
What does #pragma once mean?
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
What is bash c?
What is typeof in c?
Compare and contrast compilers from interpreters.
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
Explain how do you list a file’s date and time?
What is the purpose of sprintf?
Explain the properties of union. What is the size of a union variable
What are pointers really good for, anyway?
Explain what will the preprocessor do for a program?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?