View Code of Problem 74

#include "stdio.h"
#include "math.h"
#include "string.h"

void  main()
{
	double x1,x2=1.0;
	double x;
	scanf("%lf",&x);
	for(;x2-x1>=0.00001||x1-x2>=0.00001;)
	{
		x1=x2;
		x2=(x1+x/x1)/2;
	}
	printf("%.3lf",x2);
}

Double click to view unformatted code.


Back to problem 74