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

a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

1377


Explain do array subscripts always start with zero?

1214


What are enumerated types?

1169


How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?

1094


How we can insert comments in a c program?

1109


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

1053


What is atoi and atof in c?

1075


If null and 0 are equivalent as null pointer constants, which should I use?

1194


Why we not create function inside function.

2176


What is boolean in c?

1076


What are the types of assignment statements?

1050


Explain how do you list a file’s date and time?

1026


What is %d called in c?

1209


Explain how do you print an address?

1128


write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

2506