+ 1
Square root of N
Guys, I wrote a code, about getting the square root of any non negative number. But I am always getting close answers. I don't know if it's the only way or not. I don't want to copy other's codes. If I wanted I could have examined other's codes, but I wanted to know if you could fix my code without any dramatic changes.
10 Answers
+ 3
Thnx, Kinshuk Vasisht. 👍
+ 3
Thnx again.
+ 2
You can try using taylor series to calculate more precise square roots.
https://www.sololearn.com/discuss/292240/?ref=app
The math remains the same.
+ 2
You can read the formula from here : https://www.mathsisfun.com/algebra/taylor-series.html
The derivative of √x is 1/(2√x)
+ 2
Here is a better process, without derivatives : burningmath.blogspot.com/2013/12/finding-square-roots-of-numbers-that.html?m=1
+ 2
Jay Mathews, It's a nice code. But I'm interested in making the code without using any mathematical functions.
+ 2
Thnx, hinanawi.
+ 1
Here's my code https://code.sololearn.com/c5X3RnMAOx8q/?ref=app
+ 1
Sadly, I don't know about Taylor series.
+ 1
you can always use the newton method:
https://en.m.wikipedia.org/wiki/Newton%27s_method
Hot today
What’s wrong?
3 Votes
Question is write a c program to print prime numbers up to n and print the largest number in array.
1 Votes
Question - Java: Pyramid layers
2 Votes
Error in Program
1 Votes
SQL
1 Votes