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
Combinations of fibanocci prime series
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
How are Structure passing and returning implemented by the complier?
write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34
Explain do array subscripts always start with zero?
Explain what are the __date__ and __time__ preprocessor commands?
How do I get a null pointer in my programs?
How can I read data from data files with particular formats?
How to explain the final year project as a fresher please answer with sample project
What is call by value in c?
What are types of functions?
What does %d do in c?
Explain how can I convert a number to a string?
What is the general form of a C program?
What is the use of header files?