# Iteration Control Structure

posted by .

Design a program that models the worm's behavior in the following scenario:
A worm is moving toward an apple. Each time it moves, the worm cuts the distance between itself and the apple 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.

• Iteration Control Structure -

Design a program that models the worm's behavior in the following scenario:
A worm is moving toward an apple. Each time it moves, the worm cuts the distance between itself and the apple 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

• Iteration Control Structure -

variable distance \\distance to the apple
variable count \\ count the moves of the worm towards the apple
variable body_length \\ the length of the worm

input distance
Display {The distance between the worm and apple is “ “.}

Input body_length
Display {The worm’s length is “ “.}

while (distance >= body_length){
distance = distance - body_length
count = count +1
}

The code in the while loop (enclosed by the {}) will keep repeating until the statement in the
brackets is true. So while the distance is greater than or equal to the length of the worm it will repeat the code in the loop.

The code inside the loop has two parts as you can see. Because it always moves forward by its own body length the distance to the apple has the body length taken away from it. The count variable keeps track of how many moves the worm has taken. Hence it has 1 added to it. The loop will stop when the worm is close enough to enter the apple. It does not count the move of entering the apple.

• Iteration Control Structure -

THE ITERATION CONTROL STRUCTURE HAS 2 TYPES THE dO-UNTIL STRUCTURE AND THE DO-WHILE STRUCTURE.ITERATION{LOOP}CONTROL STRUCTURE IS A STRUCTURE IN WHICH A PROCESS MAY BE REPEATED AS LOMG AS ACERTEIN CONDITION REMAINS TRUE OR REMAINS FALSE .
IN THE DO UNTIL SRUCTURE EXIT FROM THE LOOP IS DONE AT THE END OF THE LOOP aND ALSO THE LOOP STATEMENT ARE EXECUTED AT LEAST ONCE BECAUSE THEY PERFORMED BEFORE THE PROGRAM CHECKS WETHER TO STOP OR NOT.
IN THE DO WHILE STRUCTURE ,THE LOOP EXIT CONDITION IS PLACED AT THE BEGGINING OF THE LOOP .

• Iteration Control Structure -

pak u! mga bobo

• Iteration Control Structure -

potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo potang ina niyo

• Iteration Control Structure -

This is simple come on people?!?!?

• Iteration Control Structure -

iteration control structure is a structure in which a process maybe repeated as long as certain condition remains true or false.

• Iteration Control Structure -

with this program how would it change if the worm was to enter the apple

## Similar Questions

1. ### computer programs

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 …
2. ### Iteration (repetition) Srtucture

Design a program that models the worm's behavior in the following scenario: A worm is moving toward an apple. Each time it moves, the worm cuts the distance between itself and the apple by its own body length until the worm is close …
3. ### Fundamentals of programming

Design a program that models the worm’s behavior in the following scenario:
4. ### programming

•Hi I really need help with with this I don't think I'm understanding how to do it maybe because i have never done this Design a program (you can use pseudocode to write your program) that models the worm’s behavior in the following …
5. ### programming

•Hi I really need help with with this I don't think I'm understanding how to do it maybe because i have never done this Design a program (you can use pseudocode to write your program) that models the worm’s behavior in the following …
6. ### IT 210

Design a program that models the worm's behavior in the following scenario: A worm is moving toward an apple. Each time it moves the worms cuts the distance between itself and the apple by its own body length until the worm is close …
7. ### it210

Design a program that models the worm's behavior in the following scenario: A worm is moving toward an apple. Each time it moves, the worm cuts the distance between itself and the apple by its own body length until the worm is close …
8. ### IT/210

Design a program that models the worms behavior in the following scenario: A worm is moving toward an apple. Each time it moves, the worm cuts the distance between itself and the apple by its own body length until the worm is close …
9. ### Math

A microscopic worm is eating its way around the inside of a spherical apple of a radius of 6 cm. What is the probability that the worm is within 1 cm of the surface of the apple?
10. ### Math

A microscopic worm is eating its way around the inside of a spherical apple of radium 6 cm. What is the probability that the worm is with 1 cm if the surface of the apple?

More Similar Questions