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

can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......

1809


In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

1171


What is call by reference in functions?

1321


Can you think of a logic behind the game minesweeper.

2415


Is there any data type in c with variable size?

1033


Is a pointer a kind of array?

1116


What does node * mean?

1143


if p is a string contained in a string?

1795


What is Dynamic memory allocation in C? Name the dynamic allocation functions.

1334


What do you mean by dynamic memory allocation in c?

1050


How can I read and write comma-delimited text?

1010


Can you subtract pointers from each other? Why would you?

916


What are disadvantages of C language.

1101


diff between exptected result and requirement?

1990


The file stdio.h, what does it contain?

1116