+ 1
First power of 2
Hello.i must write a program that reads the number n, from input and prints the first power of the number two, which is greater than n. I have no idea for this. I just can use for,ifelse and I can't use any method or function or library. Can you help me?
2 Answers
+ 8
why not just start with a power of 2, check it against the input. If it's bigger print it, if not take 2 to the next power
+ 3
Slick Thank you very much. It was a good idea and I wrote it.