I tried to dry run the code and couldn’t get that why exactly are we subtracting inc from ans after coming out of while loop.
Eg.
If we want to calculate the root of 10
then we get 3 as our integer part and in decimal part since 3*3=9<10
so 3 gets incremented by 0.1.
Now what is the point of subtracting 0.1 from 3 after while loop