distance remaining= constant1
subroutine: check
if distance remaining<= lengthworm
Then enter
otherwise constant1= 1/2 * constant1
return
subroutine: enter
eat apple
end
I have a problem just getting started on writing pseudocode or a program for the following problem: A worm is moving toward an apple. each time it moves, the worm cuts the distance between itself and th eapple by its own body length until the worm is close enough to enter the apple. The worm can enter the apple when it is within a body length of the apple
1 answer