The difference between a for loop and a while loop is that a for loop is a loop that happens for a certain number of times. A while loop happens until a certain condition is met. How do you know when to use each one? Give specific examples in your answer.

Respuesta :

For loop, if you have to fill water in a bucket three times, It will fill water in a bucket three times. While loop, If you have to take water from the well multiple times but stop when the water is empty in the well.

Explanation:

  • For loop is used mostly static way of programming.
  • While loop is used for dynamic approach of programming.
  • Static approach has fix number of times the task is done.
  • Dynamic approach is conditional attempt to complete the entire task.
  • For loop uses discrete which means it uses the count approach.
  • While loop is basis on characteristic, It works mostly with alphabet.
  • Functions play major role in while loop to take a dynamic approach.

Answer:

A for loop can be used to make something repeat as many times as you program it to, but a while loop only stops when you complete the task, or a certain condition is met. So, if you program a for loop to fill a bucket six times it will fill the bucket six times. But for a while loop If you have to empty water from the well but stop when the water is gone from the well.  

Explanation:

sorry I used the bucket and well situation from the other person who answered.

you should give the other person brainliest :)