View Code of Problem 74

#include <stdio.h>
#include <math.h>
int main(){
	float x1,x2=0,a;
	scanf("%f",&a);
	x1=a;
	while(fabs(x1-x2)>0.00001){
		x2=x1;
		x1=0.5*(x2+a/x2);
	}
	printf("%.3f",x1);
}

Double click to view unformatted code.


Back to problem 74