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 / hassan noureddine

int isPowrOf2 (unsigned int number)
{
float x;

if (number <= 0) return (0);

x = log(number) / log(2);
return ( (int) ( ((int)x*log(2))/log(number)));
}

Is This Answer Correct ?    4 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Here is a good puzzle: how do you write a program which produces its own source code as output?

1036


How to write a code for reverse of string without using string functions?

2074


What are linker error?

1036


What is an array? What the different types of arrays in c?

1104


What does the c in ctime mean?

1018


What is array of structure in c?

1098


Explain the use of 'auto' keyword

1073


How can I generate floating-point random numbers?

1041


What is a function simple definition?

1031


What are the similarities between c and c++?

1002


What is the purpose of main( ) in c language?

1089


What 'lex' does?

1101


What is c standard library?

1146


What is auto keyword in c?

1160


Can you define which header file to include at compile time?

982