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
write an algorithm to display a square matrix.
Write a Program to find whether the given number or string is palindrome.
What is the difference between printf and scanf )?
Explain continue keyword in c
Write a program to swap two numbers without using the third variable?
Function calling procedures? and their differences? Why should one go for Call by Reference?
Explain what is output redirection?
what is the role you expect in software industry?
what is a function method?give example?
What are the back slash character constants or escape sequence charactersavailable in c?
Why is c so important?
What are the rules for the identifier?
What is a pointer in c?
What is a lookup table in c?
Is main an identifier in c?