what is the code in c++ for finding square root of a number without using the function sqrt() in math.h???
compiler i use is visual basic 6.0.....
When I was a student, I learned the Newton's method for finding the roots of an function. The method, along with an example for square roots is in http://en.wikipedia.org/wiki/Newton%27s_method
I would recommend that method.
There are many ways of finding the square root of a number. Try reading the start of
until you reach the Taylor series.
The Taylor series might be interesting to implement. Can you find the pattern?
Also the article
has many techniques including some C source code. Find one you think you can implement and try it.
If you just want an answer, try the following that I found at
using namespace std;
double sqroot(float m)
while( (i*i) <= m )
cout<<"Square Root using sqroot()= "<<sqroot(2)<<endl;