Function to find the given number is a power of 2 or not?

Answer Posted / ms

int ispow2(int number)
{
if(n<o) {
return 0;
}

else {

return !(number&(number-1));

}

Is This Answer Correct ?    76 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I send mail from within a c program?

583


what is the diffrenet bettwen HTTP and internet protocol

1396


a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

631


Write a factorial program using C.

647


When should we use pointers in a c program?

636






What is the difference between #include and #include 'file' ?

610


Who invented bcpl language?

709


What is void c?

571


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

618


Can we replace the struct function in tree syntax with a union?

784


What is the function of this pointer?

679


Why can’t we compare structures?

818


find the sum of two matrices and WAP for it.

639


Explain what are linked list?

628


What are the basic data types associated with c?

820