View Code of Problem 74

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(){
	float x=1.0,x1=1.0;
	int a;
	scanf("%d",&a);
	do{
		x=x1;
		x1=(x+a/x)/2;
		
		//printf("%lf\n",x1);
		
	}while(fabs(x-x1)>0.00001);
	printf("%.3lf",x1);
	
}

				

Double click to view unformatted code.


Back to problem 74