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...

Give a one-line C expression to test whether a number is a
power of 2.

Answer Posted / lakshmi

void main()
{
int a;
scanf("%d",&a);

if((a&a-1)==0)
printf("Is a power of 2");
else
printf("Not a power of 2");
}

Is This Answer Correct ?    36 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to palindrom string in c language?

11142


why nlogn is the lower limit of any sort algorithm?

2868


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

4415


Write a routine to implement the polymarker function

4926


Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

2484


What is full form of PEPSI

2431


could you please send the program code for multiplying sparse matrix in c????

3598


how to test pierrot divisor

2774


How can you relate the function with the structure? Explain with an appropriate example.

3469


write a program for area of circumference of shapes

2584


How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

2560


write a simple calculator c program to perform addition, subtraction, mul and div.

3739


What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql

2932


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

1006


Design an implement of the inputs functions for event mode

3537