help please, i have to generate a funciton which generates the squareroot of any real number! I don't know what else I can do :(
#include <stdio.h>
#include <math.h>
double squareroot(double number)
{
double x[20];
int count,count2;
x[0] = 1;
for (count = 0;count <= 20;count++)
{
while ((abs(x[(count2)-1]) - x[(count2)]) > 0.001)
{
x[(count2)+1] = (((x+number/x))/2);
return x[(count2)+1];
}
}
}
main()
{
getch();
}