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 / jessu srikanth

int isPowerOf2(unsigned int n)
{
float r=n;
while(r>1) r/=2.0;
return (r==1)?1:0; /* 1-> TRUE; 0-> FALSE*/
}

Is This Answer Correct ?    9 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In a switch statement, explain what will happen if a break statement is omitted?

1072


What is bubble sort in c?

1051


What is malloc calloc and realloc in c?

1331


Can a variable be both static and volatile in c?

1040


What is a nested loop?

1128


write a proram to reverse the string using switch case?

2945


What are the different types of control structures in programming?

1132


What is a method in c?

1144


How do I convert a string to all upper or lower case?

1113


What is the purpose of clrscr () printf () and getch ()?

1071


What is the difference between far and near in c?

1067


What is the size of enum in c?

1119


what do you mean by enumeration constant?

1013


Why does everyone say not to use gets?

1105


Write the Program to reverse a string using pointers.

1019