We can you Newton`s method to solve it. Using the fact that sqrt will be less than the half the number, we can find it by binary search

```
int mySqrt(int x) {
int ub=x;
int lb=1;
while(ub>lb)
{
ub=floor((lb+ub)/2);
lb=floor(x/ub);
}
return ub;
}
```