Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / jessu srikanth

int isPowerOf2(unsigned int n)
{
float r=n;
while(r>1) r/=2.0;
return (r==1)?1:0; /* 1-> TRUE; 0-> FALSE*/
}

Is This Answer Correct ?    9 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain b+ tree?

1003


What is function in c with example?

1085


In which layer of the network datastructure format change is done

1834


How can I pad a string to a known length?

968


What are pragmas and what are they good for?

932


What is meant by high-order and low-order bytes?

1001


How can I swap two values without using a temporary?

1054


Explain the difference between exit() and _exit() function?

1104


Is void a keyword in c?

918


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1893


What is sizeof return in c?

976


What are void pointers in c?

958


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

4238


How can I avoid the abort, retry, fail messages?

1083


What will be the outcome of the following conditional statement if the value of variable s is 10?

1228