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

write an algorithm to display a square matrix.

2640


Write a Program to find whether the given number or string is palindrome.

1227


What is the difference between printf and scanf )?

1023


Explain continue keyword in c

962


Write a program to swap two numbers without using the third variable?

1016


Function calling procedures? and their differences? Why should one go for Call by Reference?

1041


Explain what is output redirection?

1136


what is the role you expect in software industry?

2085


what is a function method?give example?

2310


What are the back slash character constants or escape sequence charactersavailable in c?

1123


Why is c so important?

997


What are the rules for the identifier?

1113


What is a pointer in c?

1414


What is a lookup table in c?

1047


Is main an identifier in c?

1086