Ask Question
14 March, 23:03

Whatare the four types of loops (NOT language statements, likewhile), and what distinguishes them from eachother?

+4
Answers (1)
  1. 14 March, 23:18
    0
    Answer:The four types of loops are as following:-

    Count Loops. Sentinel Loops. Conditional Loops. Special Sentinel Loops.

    Explanation:

    You can understand the difference between each type of loop by reading their explanation.

    Count Loops:-When the program knows the ahead of time how many times Loop is going to repeat is called a Count loop. Two cases when program knows the number of times loop is going to repeat are as following:-

    1. When the loop is always repeating same number of items.

    2. When the number of repetition is user input.

    Sentinel Loops:-The loop which runs until a specific value is entered.

    For ex: - a loop will until - 1 entered if - 1 is entered the loop will finish.

    Conditional Loops:-They have common properties of both Count and Sentinel Loops. They act like sentinel loops when the program don't know how many times it will repeat. They act like count loops where they are terminating as a result of a calculation.

    Special Sentinel Loops:-These types of loops have input statement as the loop condition. For ex:-

    in c++.

    while (cin>>a)

    {

    body

    }

    This loop will terminate when user input CTRL+Z. This means that there is no more input.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Whatare the four types of loops (NOT language statements, likewhile), and what distinguishes them from eachother? ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers