I think here explanation for best case in not correct. Best or worst case should be irrespective of n. But think if n is divisible by 2 or 3 or 5 ...

And Nithish Ganeshbabu , for worst case , take any** prime numbe**r .. you will need to execute for loop for $\sqrt{n}$ times.