You have a while-loop in your program. But I can not understand what it is supposed to do since I dont speak the language it is written in.
Maybe you try to explain to us, perhaps in comments, what...