Indentation is used to show which steps are to be iterated. This variable controls the loop. The algorithm will continue to iterate until the value of count has reached 5. As soon as count reaches 5, the algorithm stops iterating. Count-controlled loops Sometimes it is necessary for steps to iterate a specific number of times. A logic-controlled loop is when you're repeating until some more general condition changes.
For instance, if you're reading a file, you want to read until you reach the end. Logic control loop will be until the logic evaluates to be true. Like the while loop. Before we execute we don't know how many times the loop will execute. But coming counter control loops we are making the loop to execute fixed number of times. Before we execute we know how many times the loop will execute. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 1 year, 3 months ago. Active 6 months ago. Viewed 2k times. Improve this question. Roberto Caboni 6, 10 10 gold badges 22 22 silver badges 37 37 bronze badges. Sujay Giri Sujay Giri 1 1 1 bronze badge. That's a false dichotomy. Either loop kind can implement any kind of logic. Learn to implement data structures like Heap, Stacks, Linked List and many more!
Check out our Data Structures in C course to start learning today. Skip to content. Change Language. Related Articles. Table of Contents. Save Article. Improve Article.
0コメント