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 we not create function inside function.

2212


When should you use a type cast?

1135


What is a constant?

1073


The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference

1246


What is a memory leak? How to avoid it?

1366


Is c easy to learn?

997


Explain what is meant by 'bit masking'?

1220


Explain the difference between #include "..." And #include <...> In c?

1040


What is the difference between printf and scanf in c?

1371


Is void a keyword in c?

993


the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above

1063


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

1491


How can a process change an environment variable in its caller?

1198


Explain the advantages and disadvantages of macros.

1106


What are categories used for in c?

1115