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 / hary

int Isnopowerof2(int n)
{
if (n & n-1)
return 0;
return 1;
}

Is This Answer Correct ?    15 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is null always equal to 0(zero)?

993


Explain what is the general form of a c program?

1035


Is a pointer a kind of array?

1119


how to construct a simulator keeping the logical boolean gates in c

2202


find the sum of two matrices and WAP for it.

1071


Can a function argument have default value?

1094


Explain union.

1117


What is far pointer in c?

1232


What is preprocessor with example?

1002


Why is c so important?

998


What is conio h in c?

1006


Explain can the sizeof operator be used to tell the size of an array passed to a function?

1017


What are header files in c programming?

1077


I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.

2322


Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1

4188