I am in c++ programming.

label Computer Science
account_circle Unassigned
schedule 1 Day
account_balance_wallet $5

I need help writing a code that checks if a variable is 2^n where n>0.... and i can't use hard code like if (n == 2 ||  n == 4 || n==8).... Please help 

Dec 10th, 2014

simply check if (n%2==0) it will do what you want. Thanks...................

Dec 10th, 2014

Did you know? You can earn $20 for every friend you invite to Studypool!
Click here to
Refer a Friend
...
Dec 10th, 2014
...
Dec 10th, 2014
Jun 27th, 2017
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer