solution to calculate sqrt