Which loop structure should be used when the number of iterations is known in advance?

  • do-while loop
  • for loop
  • if statement
  • while loop
The for loop is ideal when you know the number of iterations in advance. It consists of an initialization, condition, and increment/decrement statement. This loop is suitable for iterating over arrays, collections, or any situation where the number of iterations is predetermined.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *