A

Admin • 833.24K Points
Coach

Q. Which type of loop is best when the end condition depends on user input?

  • (A) for
  • (B) while
  • (C) do-while
  • (D) foreach
  • Correct Answer - Option(C)
  • Views: 23
  • Filed under category Java
  • Hashtags: Java Loops

Explanation by: Admin

do-while ensures the loop runs at least once, useful for input-dependent ends.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.