Could copy and paste your square root code
With a few changes, you could copy your original code that computes the square root and insert it as in-line code at each location in your program where you need to calculate the square root of a number.
Is there a better way?
After doing this a few times, you might start asking yourself if there is a better way.
The answer is "yes, there is a better way."