Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question: 18 say you want to write a program to have karel put down 300…

Question

question: 18 say you want to write a program to have karel put down 300 tennis balls. which control structure would you use? if statement while loop for loop nested while loop

Explanation:

Brief Explanations

An if - statement is for conditional execution. A while - loop repeats as long as a condition is true. A for - loop is ideal for a fixed number of iterations like putting down 300 tennis balls. A nested while - loop is for more complex repetitive tasks with multiple conditions. Since we know the exact number of times (300) we need to perform an action, a for - loop is the best choice.

Answer:

C. For loop