Challenge: The Nearest Power of 2

Task

Write a program that takes a positive number (num) and finds the power of 2 nearest to that number. The program stores the resulting value to pwr.

Get hands-on with 1400+ tech skills courses.