That's programming: the computer does what you tell it to do.

I am sure you can fix it. Look up 'while()' in a C book.