View Code of Problem 74

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

Double click to view unformatted code.


Back to problem 74