Ask Question
28 March, 10:01

How many times does the following loop body execute? int count = 52; for (int i = 0; i < count; i++) {cout << count << endl; --count; }

26

52

25

None of the above

+2
Answers (1)
  1. 28 March, 10:28
    0
    The correct option is (a) that is 26.

    Explanation:

    In the for loop,"i" started with 0 and the initial value of "count" is 52. In the First

    iteration it will print "52" as output. Then the value of "count" is decreased by 1 and become 51. So in the next iteration,"i" increased by 1 and become 1. then it will check i
    When we run this loop, we get 26 numbers from 52 - 27.

    52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27

    this is the output of the given loop.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “How many times does the following loop body execute? int count = 52; for (int i = 0; i < count; i++) {cout ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers