0
How I can Find square root in c++ without sqrt and cmath?
I need to find square root in c++ without use any Functions any one can tell me?
4 Antworten
+ 1
You could implement the babylonian method
next = (prev - num/prev)/2
Iterate that until either 'next' and 'prev' are near enough or 'next' and 'num' are
Where 'num' is the number you want the sqrt of
This method will always approach the +sqrt from above with positive initial guesses,
and -sqrt from below with negative initial guesses
The closer the initial guess is from the root the better
1 and num are equally good initial guesses
+ 3
ABUBAKAR ALHOMIDY i found few codes on Sololearn playground
https://code.sololearn.com/csRh857XrOzh/?ref=app
https://code.sololearn.com/clRb7VT9M50x/?ref=app
0
Can you give the code?
0
Thanks for your?