Psuedo Code? 1

Write a program, that uses the following algorithm, as part of a function, to determine if a number n ≥ 2 is a power of 2, such as 21 = 2, 23 = 8 or 210 = 1024, but not 24 - 3 = 13. To do this, you need to repeatedly attempt to divide n by 2k, where k = 1, 2, 3, ... until n is either found to be divisible by 2k or 2k > n. The function returns true if n is a power of 2 and false otherwise. The result, either yes or no, is output to the screen. The value n, is entered, via the keyboard, by the user. Your submission should include a screenshot of the execution of the program using each of the values n = 2, 3, 4, 5, 10, 16, 35, 101 and 128.

Can anyone break this down for it terms of a sort of psuedo code?

For instance,

Pseudo code:

decalre vairable x
decalre variable y
declare variable sum

main function start

sum = variable x + varible y

display sum

stop

Proper code:

int x = 2;
int y = 2;
int sum;

int main () {

sum = x + y;

cout << sum;

}

I would really appreciate any kind of help.
Topic archived. No new replies allowed.