Let N be the number whose square root we need to calculate.
Initialize start = 0 and end = N.
Repeat the following steps while (end – start) > 0.00001 (it defines the precision) Set mid = (start+end)/2. If mid*mid < N, then set start = mid. If mid*mid >= N, then set end = mid.
Answers & Comments
Explanation:
Steps
Let N be the number whose square root we need to calculate.
Initialize start = 0 and end = N.
Repeat the following steps while (end – start) > 0.00001 (it defines the precision) Set mid = (start+end)/2. If mid*mid < N, then set start = mid. If mid*mid >= N, then set end = mid.
The final answer is