"Things should be made as simple as possible, but no simpler." -- Albert Einstein
/*A function that returns the square root of the number without using built-in functions*/double sqrt(double num){ double guess = num/2, oldguess = 0; while(guess != oldguess) { oldguess = guess; guess = (num/guess + guess)/2; } return guess;}
/*A function that returns the square root of the number without using built-in functions*/
ReplyDeletedouble sqrt(double num)
{
double guess = num/2, oldguess = 0;
while(guess != oldguess)
{
oldguess = guess;
guess = (num/guess + guess)/2;
}
return guess;
}