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

int ispwrof2(int num)
{
int temp = 0;
if(num <= 0)
return 0;
else if(num > 0)
{
while(num%2 == 0)
{
temp = num/2;
num = temp;

}

}
if(num == 1)
return 1;
else
return 0;
}

Is This Answer Correct ?    18 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Combinations of fibanocci prime series

1666


What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1191


How are Structure passing and returning implemented by the complier?

1228


write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34

2255


Explain do array subscripts always start with zero?

1287


Explain what are the __date__ and __time__ preprocessor commands?

1161


How do I get a null pointer in my programs?

1166


How can I read data from data files with particular formats?

1094


How to explain the final year project as a fresher please answer with sample project

1027


What is call by value in c?

1053


What are types of functions?

1080


What does %d do in c?

1012


Explain how can I convert a number to a string?

1207


What is the general form of a C program?

1070


What is the use of header files?

1157