can you please explain why are we using a for loop and how is this loop working
Doubt in solution
see code is quite basic
Say we have precision 1 then
Say we have to find sqrt of 10
Then we check 1 * 1<=10 increment
2 * 2<=10 we increment
3 * 3<=10 we increment
Now 4 * 4>10 so we stop for current p=0 and do ans-precision
now p=1 so we divide 1 by 10 which is 0.1
So
3.1 * 3.1=9.61
3.2 * 3.2=10.24 which is greater than 10
so we do 3.2-0.1 =3.1 and we stop for p=1
Hence ans =3.1