Even this is one of the most frequently asked interview questions. I really dont know whats so great in it. Nevertheless, here is a C program
if(!(num & (num - 1)) && num)
// Power of 2!
//Power of 2!
I leave it up to you to find out how these statements work.