int sq_root ( int a ) { int lo = 0; int hi = a; while( hi - lo > 1 ) { int x = (lo+hi)/2; if( x*x < a ) lo=x; else hi=x; } return lo; }