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 / abhishek sharma

unsigned int is_power_of_2(unsigned int x)
{
return (x != 0) && ((x & (x - 1)) == 0);
}

Is This Answer Correct ?    23 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How are strings stored in c?

1029


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2654


what is reason of your company position's in india no. 1.

2347


What does 1f stand for?

1179


FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above

1128


What is return type in c?

1148


What does node * mean?

1252


difference between native and cross compilers

2142


What is operator promotion?

1087


What is pragma in c?

1227


What do you understand by friend-functions? How are they used?

1215


What is the value of uninitialized variable in c?

1043


write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.

2110


Is int a keyword in c?

989


Is there a way to switch on strings?

1100