About the initialization of value

why did we take value of i=2?

why did we not take i<=n?

@pmschhabra
i is the variable which counts how many integers we have already printed. Since 0 and 1 are printed before the loop is begun , we should start our loop countert variable i from 2 only.
As for why we did not take i<=n but rather i<n , it is the same reason. If we were to take i<=n , we would have ended up printing 11 terms on an input of 10.
Value of i changes from
i = 2 , prints 1
i = 3 , prints 2
i = 4 , prints 3
i = 5 , prints 5
i = 6 , prints 8
i = 7 , prints 13
i = 8 , prints 21
i = 9 , prints 34
i = 10 , loop breaks

Since 0 and 1 had already been printed before and printed 8 more numbers , that gives us a total of 10 numbers printed which is exactly what we intended.