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

main()
{
int n,m;
do
{
m=n%2;
n=m;
}
while(n>1);
if(m==1)
{
Printf("Number is not a power of 2");
}
else
{
printf("Number is a power of 2");
}
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do string constants represent numerical values?

1450


How is a null pointer different from a dangling pointer?

1091


write a program to create a sparse matrix using dynamic memory allocation.

4958


Why array is used in c?

1064


What are the different types of linkage exist in c?

1076


Why is it usually a bad idea to use gets()? Suggest a workaround.

1879


What is #line?

1115


How can I pad a string to a known length?

1089


What do you mean by a sequential access file?

1136


What are the keywords in c?

1177


What is double pointer in c?

1092


What is the use of a static variable in c?

1113


any "C" function by default returns an a) int value b) float value c) char value d) a & b

1140


What are the types of pointers in c?

1084


How is = symbol different from == symbol in c programming?

1107