I am in c++ programming.

User Generated

ovyylznq

Computer Science

Description

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 

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

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


Anonymous
Great! 10/10 would recommend using Studypool to help you study.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Similar Content

Related Tags