This web page requires JavaScript to be enabled.

JavaScript is an object-oriented computer programming language commonly used to create interactive effects within web browsers.

How to enable JavaScript?

TÍNH CĂN BẬC HAI THEO PHƯƠNG PHÁP LẶP NEWTON [C]

10cth1-2 October 27, 2010 0
#include <stdio.h>
#include <math.h>

void main()
{
    double a, xn, ketqua;

    printf("\nNhap vao so muon tinh can bac hai : ");
    scanf("%lf", &a);
    xn = (a+1)/2;
    do {
        ketqua = xn;
        xn = 0.5 * (xn + a/xn);
    } while (fabs(xn-ketqua) > 0.0001);
    printf("\nKet qua = %lf", xn);
    getch();
}

Last modified on December 19th, 2020 at 6:59 pm

Nam Le
lequocnam



0 responds

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.