View Code of Problem 74

#include<stdio.h>
#include<math.h>
int main(){
	float a;
		scanf("%f",&a);
    float x1=a/2;
	float x2=(x1+a/x1)/2;

	while(fabs(x2-x1)>=0.00001){
		x1=x2;
		x2=(x1+a/x1)/2;
	}	
	printf("%.3f",x2);
}

Double click to view unformatted code.


Back to problem 74