Why precision is only upto 5 places?

// finding the square root using BINARY_SEARCH
#include
using namespace std;
float find_sqrt(int n,int p)
{
float ans=-1;
int start=0;
int end=n;
while(start<=end)
{
int mid=(start+end)/2;
if(midmid==n)
return mid;
else if(mid
mid<n)
{
ans=mid;
start=mid+1;
}
else
end=mid-1;
}
float inc=0.1;
for(int i=0;i<p;i++)
{
while(ans*ans<=n)
{
ans+=inc;
}
ans-=inc;
inc/=10;
}
return ans;
}
int main()
{
int n,p;
cin>>n>>p;
float ans=find_sqrt(n,p);
cout<<ans<<" is the sqrt of the given number";
return 0;
}

what do u exactly want to know ?
Why is ur code producing result till 5 precision or what?

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.