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

How can I write functions that take a variable number of arguments?

1195


Write a program to show the change in position of a cursor using c

1127


What header files do I need in order to define the standard library functions I use?

1129


Explain the array representation of a binary tree in C.

1288


Do variables need to be initialized?

1113


how many errors in c explain deply

2138


Why do some versions of toupper act strangely if given an upper-case letter?

1120


What is the right way to use errno?

1124


shorting algorithmS

2315


What is the purpose of sprintf?

1209


What does void main return?

1199


find out largest elemant of diagonalmatrix

2328


What is assert and when would I use it?

1070


What are examples of structures?

1193


Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon

6024