View Code of Problem 74

#include<stdio.h>
#include<math.h>
#include <string.h>
#define Max 1000
int main ()
{
	double a,b,s;
	scanf("%lf",&s);
	b=1.0;
	do{
		a=b;
		b=(a+s/a)/2.0;
	}while(fabs(a-b)>=0.00001);
	
	printf("%.3f",b);
	return 0;

}

Double click to view unformatted code.


Back to problem 74