#include #include double my_root(double x) { double guess; const double epsilon = 0.00001; guess = 1; while((guess * guess < x - epsilon) || (guess * guess > x + epsilon)) { guess = (x / guess + guess) / 2; } return guess; } int main() { double v = 6; printf("sqrt(%f) = %f | %f\n", v, sqrt(v), my_root(v)); return 0; }