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

Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

1076


What is variables in c?

983


What is the collection of communication lines and routers called?

1052


How does pointer work in c?

1070


What is int main () in c?

1025


What are the header files used in c language?

992


Why we use stdio h in c?

982


Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)

1216


What should malloc() do?

1100


Explain high-order bytes.

1060


What is the code in while loop that returns the output of given code?

1893


What is a example of a variable?

949


Can 'this' pointer by used in the constructor?

1043


What is the difference between %d and %i?

1042


Write a C program to count the number of email on text

1852