Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question # 4 multiple select which situations are better suited to an i…

Question

question # 4
multiple select
which situations are better suited to an indefinite (while) loop? select 3 options.
writing a program that will average 20 numbers
writing a program to average numbers without requiring the user to count the numbers
allowing the user to enter their best friends names without saying how many friends they can have
writing a program to average the temperatures for the last 30 days
having the user guess a number and keep guessing till they get it right

Explanation:

Brief Explanations

An indefinite (while) loop is used when the number of iterations is not known in advance. Writing a program to average numbers without user - counting, allowing name entry with unknown quantity, and having user guess until correct all have an unknown number of iterations. Programs averaging a fixed number of items (20 numbers or 30 - day temperatures) are better suited for definite loops.

Answer:

  • writing a program to average numbers without requiring the user to count the numbers
  • allowing the user to enter their best friends names without saying how many friends they can have
  • having the user guess a number and keep guessing till they get it right