Implement Function Powersoftwo Takes Positive Integer N Parameter Prints One Line Powers 2 Q37222601

Implement a function powersOfTwo) that takes a positive integer n as parameter, and prints (on one line) all the powers of 2,

Implement a function powersOfTwo) that takes a positive integer n as parameter, and prints (on one line) all the powers of 2, from 1 to n. For example: when n 6 your function should print: 2, 4, 8, 16, 32, 64 These values are obtained by printing: 2, 22, 23, 24, 25, 26 The screenshot below shows how you would call the function powersOfTwo() and what it would display for several examples. In order to

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.