Loop would never end right?


#1

Why do we have to calculate the time complexity of this question?

for N>0, the loop would never end right?


#2

Seems like it. Makes no sense to me.


#3

since the variable i is an integer (and not a float or double), any number 0 < n < 1 will equal 0


#4

Yes, rmitsubayashi is right. Since the number is an integer, the result of dividing a smaller integer by a greater integer will be zero. i.e, 1/2 = 0.

And loop would never end if it was (i >- 1)


#5

Strongly disagree as in python 1/2 = 0.5. It should be language agnostic. Moreover, that does not seem to be the goal of this problem. Also, its just bad code as it is not readable. Beautiful is better than ugly. Explicit is better than implicit . Simple is better than complex. Complex is better than complicated.


#6

Since initially ā€˜iā€™ is taken as an INTEGER.So at some point the value of i would be in decimal for example 1/2=0.5 but it will store it as integer value i.e 0 and the loop will terminate.