View Code of Problem 74

#include<stdio.h>
#include<math.h>
double f(double a,double x){
	double res=(x+a/x)/2;
	if(abs(x-res)<0.0001)
		return res;
	else 
		f(a,res);
}
int main(void){
	double a;
	scanf("%lf",&a);
	printf("%.2lf",f(a,a/2));
} 

Double click to view unformatted code.


Back to problem 74