View Code of Problem 74

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

Double click to view unformatted code.


Back to problem 74