求助
```// 此程序求绝对值
float absolutevalue (float x)
{
if ( x < 0)
x = -x;
return x;
}
//此程序求squreRoot 中 while 循环次数
int times (float esplion){
int i;
while (esplion != 1) {
esplion *= 10;
i ++;
}
return i;
}
//此程序求平方根
float squreRoot (float x, float esplion)
{
float guess = 1.0;
while (absolutevalue (guess*guess - x) >= esplion )
{
int i;
for ( i = 0; i<= times(esplion); i++)
{
guess = (x/guess + guess)/2.0;
printf ("The guess is %f.\n", guess);
}
}
return guess;
}
int main ()
{
printf ("Enter you number : \n");
float x, esplion ;
scanf ("%f", &x);
printf ("Enter you esplion: \n");
scanf ("%f", &esplion);
printf ("The squreroot of the %f is %f", x, squreRoot (x, esplion));
return 0;
}