Function to find the given number is a power of 2 or not?
Answer Posted / sahil
int ispwrof2(int num)
{
int temp = 0;
if(num <= 0)
return 0;
else if(num > 0)
{
while(num%2 == 0)
{
temp = num/2;
num = temp;
}
}
if(num == 1)
return 1;
else
return 0;
}
Is This Answer Correct ? | 18 Yes | 7 No |
Post New Answer View All Answers
What is nested structure?
Differentiate abs() function from fabs() function.
Why functions are used in c?
how can use subset in c program and give more example
how to construct a simulator keeping the logical boolean gates in c
find out largest elemant of diagonalmatrix
Why is c platform dependent?
How can I find the modification date and time of a file?
Is null a keyword in c?
What are reserved words with a programming language?
How can I read and write comma-delimited text?
FILE PROGRAMMING
Why is c so powerful?
Explain null pointer.
When should volatile modifier be used?