View Code of Problem 74

#include<stdio.h>
#include<math.h>
main()
{
	double a,b,x;
	scanf("%lf",&x);
	a=x/2;
	b=1.0/2.0*(a+x/a);
	do{
		a=b;
		b=1.0/2.0*(a+x/a);
	}while(fabs(a-b)>=0.00001);
	printf("%.3f\n",b);
}

Double click to view unformatted code.


Back to problem 74