'=========================================================================== ' Subject: WORM PROBLEM Date: 02-24-98 (13:26) ' Author: Aaron Andersen Code: QB, QBasic, PDS ' Origin: kc7gza@hotmail.com Packet: ALGOR.ABC '=========================================================================== 'A worm is standing on the end of a rope 100 inches long. Each second the ' worm crawls 1 inch and the rope streches 100 inches. If the rope can ' ' strech forever and the worm can crawl forever will the worm ever reach the ' end? Yes he will and this program will find out how long it will take. ' ' rps# How much the rope streches each second. The rope is this ' long at the starting 'wrms# How much the worm crawls each second. 'prs# How often the computer will print the status of the program. ' Kc7gza@hotmail.com CLS CLEAR rps# = 10 wrms# = 1 prs# = 1 rpl# = rps# DO IF stp# MOD prs# = 0 THEN PRINT stp#; " "; MID$(STR$(wrm# / rpl# * 100), 1, 8); "%"; " "; wrm#; " "; rpl# wrm# = wrm# + wrms# wrm# = wrm# + ((wrm# / rpl#) * rps#) rpl# = rpl# + rps# stp# = stp# + 1 LOOP UNTIL wrm# >= rpl# PRINT "finished in"; stp#; "steps" PRINT "worm ="; wrm# PRINT "rope = "; rpl#; END