View Code of Problem 74

#include <stdio.h>
#include <math.h>
int main()
{
  double a,b=1.0,x;
  scanf("%lf",&x);
  while(fabs(b-a)>=1.0e-5)
  {
    a=b;
    b=(a+x/a)/2.0;
  }
  printf("%.3lf",b);
  return 0;
}

Double click to view unformatted code.


Back to problem 74