#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