Optimize program

How can I fix this problem? If can call it that.
My programming language is not good.