#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
float f(float x)
{
float s;
s=cos(x)/2;
return s;
}
main()
{
printf("\nPHUONG PHAP LAP DON");
printf("\n........................__GROUP2__........................");
float e,k,x,x0,c,a;
printf("\nnhap e");
scanf("%f",&e);
printf("nhap x0");
scanf("%f",&x0);
k=0;
printf("\nbl\tnxi\tsaiso");
while(1)
{
x=f(x0);
a=(x-x0);
if(a<0)
a=a*(-1);
k=k+1;
printf("\n%2.4f\t%2.4f\t%2.4f",k,x,a);
if(a<e)
goto xong;
else
x0=x;
}
xong :printf("\n_(-_-)_ _(*_*)_ _(-_-)_ _(*_*)_ _(-_-)_ _(*_*)");
printf("\nnghiem gan dung can tim lax=%2.4f",x);
printf("\nso buoc lap la%f",k);
getch();
}