Computer Science, asked by raju1887, 5 months ago

How many times the following loop
will run?
>>>i=5
>>>while (i>0):
>>> i=i-1

Answers

Answered by CoderRishav
2

Bro Actually its an error, because i = i - 1 , will be inside while, it should be like this

>>> i = 5

>>> while (i > 0):

i -= 1

>>>

The loop will run 5 times, and you can check it simply by taking a counter variables, like

i = 5

count = 1

while (i > 0):

i -= 1

print(count)

count += 1

Similar questions