Function to find the given number is a power of 2 or not?
Answer Posted / hassan noureddine
int isPowrOf2 (unsigned int number)
{
float x;
if (number <= 0) return (0);
x = log(number) / log(2);
return ( (int) ( ((int)x*log(2))/log(number)));
}
| Is This Answer Correct ? | 4 Yes | 6 No |
Post New Answer View All Answers
What are pointers?
Explain built-in function?
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
What is union and structure?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
Why flag is used in c?
In C, What is the #line used for?
What is meant by realloc()?
What kind of structure is a house?
How many keywords (reserve words) are in c?