View Code of Problem 74

#include<stdio.h>
#include<math.h>
int main(){
	double a,x2,x1=1;
	scanf("%lf",&a);
	do{
		x2=x1;
		x1=(x2+a/x2)/2;
	}while(fabs(x1-x2)>0.00001);
	printf("%.3lf",x2);
	return 0;
}

Double click to view unformatted code.


Back to problem 74