Ad
  • Custom User Avatar

    You don't have to go through all numbers from 0 to n. Going from 0 to i * i > n is enough. The numbers after i * i > n cannot be a square root of n. I would rather use an algorithm without a loop.