Question: I need some help programing this in C. powers of 2 - print powers of 2 up to specified maximum The program should read a

I need some help programing this in C.I need some help programing this in C. powers of 2 -

powers of 2 - print powers of 2 up to specified maximum The program should read a single integer value. It should then print a single line of output with all of the powers of 2 (1, 2, 4, 8, 16, etc.) up to (and if appropriate, including) the input value. The numbers printed in the output line should be separated by at least one space character. Example: if the input value is 42, then the output should be 1 2 4 8 16 32 Example: if the input value is 211, then the output should be 1 2 4 8 16 32 64 128 Hints Use an accumulator variable to store the current power of two (think about what its initial value should be) The next power of two can be found by multiplying the current power of two by 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!