View Code of Problem 74

#include<stdio.h>
#include<string.h>
#include<math.h>

int main()
{
	double a,x1=0,x2=1;
	scanf("%lf",&a);
	while(fabs(x2-x1)>=0.00001){
	
		x1=x2;
		x2=0.5*(x1+a/x1);
	
	
	}
	printf("%.3lf",x2);

}

Double click to view unformatted code.


Back to problem 74