There is one final goto in this code, and that goto is a loop in disguise. So removing it requires adding a do-while loop, and removing both the if statement, the associated goto and the label 5.
This is what the code looks like now (underlined code is the code of interest):
5 if (totdis.gt.250) goto 10 tower = 1 ... totdis = totdis+10 if (totdis.le.1000) goto 5
Now we replace this with a do-while construct:
do while (totdis.le.1000) tower = 1 ... totdis = totdis+10 end do
Easy right? here’s the current state of the code: