How do I do this program?

It's a good start, but the button read needs to be in loop, not startup.

I think you mean "1 << x"

Please remember to use code tags when posting code