I have this code that should calculate the square root of a number useing newton's method.
It compiles and runs , but while I debug ,it doesn't give the right answer for most numbers (except for the roots of 4,16,25, 36 etc)thanks for any help !
int squareRoot(int num,int ans,int tol);
printf("Enter the number you want squarerooted");
printf("Enter your guess of the number's root");
printf("Enter the pretidetermined tolerance");
root = squareRoot(num,ans,tol);
printf("%d%d","The square root of ",num," is:",root);
int squareRoot(int num,int ans,int tol)
if((ans^2 - num <= tol))
return (squareRoot(num,((ans^2 + num)/(2 * ans)),tol));