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

int n = 3;
boolean bool = true;
int reminder;
while (n >1)
{
reminder = n % 2;
if(reminder != 0)
{
bool = false;
break;
}
else
{
n = n / 2;
}
}
if (bool == true)
printf("The number is a power of two");
else
printf("The number "+ m + " is NOT A power of two");

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of ftell?

1083


Why c is called top down?

1157


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

2075


How does #define work?

1067


What's the best way of making my program efficient?

1108


write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

2132


Why do we use main function?

1179


What are the ways to a null pointer can use in c programming language?

1137


A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM

2125


Is c call by value?

1019


Can you explain the four storage classes in C?

1121


What is the difference between the expression “++a” and “a++”?

1234


What are the types of data types and explain?

1091


What is array of structure in c?

1177


how to find anagram without using string functions using only loops in c programming

3192