Can you please tell me why we are checking that i * i < n in for loop

why we don’t write i< n
can you tell me about this more why this approach is not much effective although it is correct

because if we analyse any number
eg
36 -> factors are 2 , 3 , 4, 6 , 13,12,9,6
all prime factor occur before the square root of the number which can be written either as
i <= sqrt(n) or
i * i <= n
so for optimisiation purpose we do
i* i <= n