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

Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2580


program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)

2096


What is call by value in c?

1003


a value that does not change during program execution a) variabe b) argument c) parameter d) none

1236


#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }

1058


What is the value of a[3] if integer a[] = {5,4,3,2,1}?

1087


State the difference between x3 and x[3].

1112


How will you declare an array of three function pointers where each function receives two ints and returns a float?

1362


Where define directive used?

1092


What are the types of bitwise operator?

1113


How can I call fortran?

1043


How are pointers declared in c?

1062


How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?

1112


What is the function of volatile in c language?

1130


What is static function in c?

1115