#include <iostream>
#include <cmath>

using namespace std;

int main() {
    double c = 15.0;
    double eps = 0.001;
    double x = c;          // początkowe przybliżenie
    double x_next;
    int iteracje = 0;

    do {
        x_next = 0.5 * (x + c / x);
        x = x_next;
        iteracje++;
    } while (fabs(x * x - c) > eps);

    cout << "Przyblizona wartosc pierwiastka z " << c << " wynosi: " << x << endl;
    cout << "Liczba iteracji: " << iteracje << endl;

    return 0;
}
