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
hi, which software companys will take,if d candidate's % is jst 55%?
Is file a keyword in c?
How does pointer work in c?
What is the sizeof () a pointer?
What is pointer & why it is used?
Can stdout be forced to print somewhere other than the screen?
Explain how do you search data in a data file using random access method?
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?
What is strcmp in c?
What is variable declaration and definition in c?
In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping
What is the auto keyword good for?
Why does the call char scanf work?
What is a stream?
write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1