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
What do you mean by c what are the main characteristics of c language?
What are the disadvantages of external storage class?
What is time null in c?
What is the use of in c?
How to set file pointer to beginning c?
Which is best book for data structures in c?
write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.
Explain how do you list a file’s date and time?
Explain what are multibyte characters?
How we can insert comments in a c program?
code for quick sort?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
how should functions be apportioned among source files?
Why clrscr is used after variable declaration?
What is pivot in c?