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...

Determine if a number is a power of 2 at O(1).

Answer Posted / srinu naik

if((~n+1)& n ==n) printf("\n Given number is power of 2");
else printf("\Not the POwer of 2");

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why does not c have an exponentiation operator?

1121


What is actual argument?

1103


What does the characters “r” and “w” mean when writing programs that will make use of files?

1545


What are the different types of constants?

1133


What is formal argument?

1194


what are the 10 different models of writing an addition program in C language?

1947


Can you write a programmer for FACTORIAL using recursion?

1101


What is an example of structure?

1102


Is it better to use a macro or a function?

1211


How can I prevent another program from modifying part of a file that I am modifying?

1111


Explain continue keyword in c

1068


How do c compilers work?

1201


What are pointers? What are different types of pointers?

1226


Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?

1139


Explain what are the __date__ and __time__ preprocessor commands?

1163