Sir this monotonic search is not giving output

#include
#include
using namespace std;
int sqrt(int n)
{
int s=0;
int e=n;
float ans=-1;
while(s<=e)
{
int m=(s+6)>>1;
if(mm==n)
{
return m;
}
else if(m
m<n)
{
ans=m;
s=m+1;
}
else
{
e=m-1;
}
}
return ans;
}
int main()
{
int n;
cin>>n;
cout<<sqrt(n);

return 0;

}

hello @Abhishmu5

this should be (s+e) >>1;

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.