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

double sqrt2(double n) {

      float x = n,
            y = 1.0,
            e = 0.0000000001;
            while(x-y>e) {
              x = (x + y ) / 2;
              y = n / x;
            }    
      return x;

}
int main(void) {
	printf("%.7f\n", sqrt2(2));
	printf("%.7f", sqrt(2));
	return 0;
}
