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


Determine if a number is a power of 2 at O(1).

Answers were Sorted based on User's Feedback



Determine if a number is a power of 2 at O(1)...

Answer / hary

int Isnopowerof2(int n)
{
if (n & n-1)
return 0;
return 1;
}

Is This Answer Correct ?    15 Yes 0 No

Determine if a number is a power of 2 at O(1)...

Answer / srinu naik

if((~n+1)& n ==n) printf("\n Given number is power of 2");
else printf("\Not the POwer of 2");

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Interview Questions

What is a class c rental property?

0 Answers  


What is echo in c programming?

0 Answers  


Two's compliment of -5

4 Answers   Adobe,


Explain how can I right-justify a string?

0 Answers  


how to execute a program using if else condition and the output should enter number and the number is odd only...

0 Answers  


What is the purpose of macro in C language?

0 Answers   Fidelity,


What is an identifier?

0 Answers  


Define VARIABLE?

0 Answers   ADP,


2. What does static variable mean?

2 Answers  


Write a c program for sum of first n terms of the series S = 1 - (1/3) + (1/5) -(1/7) + (1/9) ......

2 Answers  


will the program compile? int i; scanf(ā€œ%dā€,i); printf(ā€œ%dā€,i);

3 Answers  


What is strcpy() function?

0 Answers  


Categories