Code for computing square roots using Newton's formula