- 2
i=4 ,while i>=0,print(i),print i-1
how we get 4 ans ?????
4 Answers
+ 3
Could you please post the real code?
Your code in the title seems like semi code and would be an endless loop were you print 4 and 3 in every iteration.
+ 2
Ok, so you start with 3 and enter the loop as long as i is greater or equal to zero.
As you are decrementing i by 1 in every iteration, you will have 4 iterations.
And in every iteration you also print the current i, so that's why you get 4 outputs.
3
2
1
0
+ 1
thanks Matthias...
0
sory....the code is:
i=3
while i>=0:
print(i)
i=i-1