Computer Science, asked by pratima22111976, 3 months ago



5. Which of these looping conditions will induce an infinite loop? The starting value of i is 0.
while (i>0)
b. for i in range (1, 1, 1) c. while(i==0)

Answers

Answered by sarahssynergy
5

Option(c.) while(i==0) will induce an infinite loop.

Explanation:

  • In while loop is used to execute a block of statements repeatedly until a given a condition is satisfied.
  • And when the condition becomes false, the line immediately after the loop in program is executed.
  • hence when the value of 'i' is initialized to 0 and condition in the while loop is given to be i==0, this condition holds to be true always
  • hence, while(i==0) will start an infinite loop.

Answered by kavleen2610
4

Answer:

(c) while (i==0)

Similar questions