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

Answer 2 Ms is correct and more efficient.

because if a number is power 2 it is in form

1000---->8
100----->4
10------>2 like form
subtract one from that and do with bitwise and it should be
zero.

ie 1000(8) & 0111(7)== 0

Is This Answer Correct ?    55 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does struct node * mean?

1016


What is n in c?

1045


What are the 5 organizational structures?

1027


What is the use of typedef in structure in c?

970


What's the difference between constant char *p and char * constant p?

1151


How many keywords (reserve words) are in c?

1142


Which header file should you include if you are to develop a function which can accept variable number of arguments?

1401


Define VARIABLE?

1164


What does the error message "DGROUP exceeds 64K" mean?

1221


What is memcpy() function?

1118


how to make a scientific calculater ?

2071


What does & mean in scanf?

1107


What is a floating point in c?

1073


How does #define work?

1067


How can I remove the leading spaces from a string?

1170