130k views
3 votes
In which of the following scenarios would it be best to use a for loop?

1. When you need to stop looping based on input from the user
2. When you need to check that a user's input is valid.
3. When you want to ask the user for 10 numbers
4. When you need to be able to use the block of code in many places in your program

In which of the following scenarios would it be best to use a for loop? 1. When you-example-1
User Adam Brown
by
4.5k points

1 Answer

5 votes

Answer:

I would say 3 is the most likely answer ("When you want to ask the user for 10 numbers").

You use for loops to perform a task x times usually.

User USMAN FAZIL
by
4.9k points