If n is the given number, then the expression (n & (n-1)) = 0 gives the logical output depicting if it is a power of 2 or not, if (n & (n-1) == 0) printf (“The given number is a power of 2”);

# Write a constant time consuming statement lot finding out If a given number Is a power of 2?

Category: Embedded Systems Interview Questions.