Bloomberg Interview Question

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

Interview Answers

Anonymous

Mar 6, 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

Nov 5, 2011

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