Link to home
Start Free TrialLog in
Avatar of mmt33
mmt33

asked on

Simplest code for checking if a number is 2 to the power n?

Hello,
  I am new to C language. I just know printf and scanf. I need some code very urgently. Can you give me simplese code possible (Not more than 4 lines), to check whether a number is 2 to the power n or not.
Eg :
For the numbers 2, 4, 128 it should return 1;

Thanks in advance,
MMT33
ASKER CERTIFIED SOLUTION
Avatar of sreenathk
sreenathk
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mmt33
mmt33

ASKER

That's too good. I  accept this answer and thanks to you sreenathk

mmt33