Answered Questions

  • finding a number which is a power of 2in a single step

    How to find whether the given number is a power of 2 in single step (without using loops)?

    Surender Reddy G

    • Jun 2nd, 2015

    Code
    1. int x=64;
    2. if(x&&(x&(x-1))) printf(" x is not the power of 2");
    3. else printf("x is power of 2");

    sreethu

    • Aug 10th, 2011

    this is based on binary numbers"c #include #include int power_of_two(int); void main() { int n; printf("enter the number"); scanf("%d",&n); power_of_two(n); } int power_of_...