Ask Question

If you want a user to enter exactly 20 values, which loop would be the best to use?

1. do-while

2. while

3. for

4. infinite

5. None of these

+5
Answers (1)
  1. 28 June, 06:15
    0
    Answer: For loop

    Explanation:

    Using the for loop we can get the exact number of values/outcomes we require.

    For example: printf (enter 20 numbers");

    for (int i=0; i<20; i++)

    {

    scanf ("%d", &number);

    }

    So, this is an implementation of for loop in C. Using it we can enter exact 20 numbers not less or more than that.

    Therefore, for loop is the answer.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “If you want a user to enter exactly 20 values, which loop would be the best to use? 1. do-while 2. while 3. for 4. infinite 5. None of these ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers