Bloomberg interview question

Find the square root of a number without using the standard library function.

Interview Answers

Anonymous

6 Mar 2012

Check this video, this explained in detail how to use binary search to find the sqrt of the given number, http://www.youtube.com/watch?v=XvsQ68jUc2U

2

Anonymous

5 Nov 2011

double squareroot(double num) { sr=1; while (num>1) { num=num/2.0; sr=0.414*sr; } return sr; }