#include<stdio.h>
#include<conio.h>
#include<math.h>
double fx(double x) //Given the function is x3+4x-10
{
double f;
f=(x*x*x)+(4*x*x)-10;
return f;
}
double fdx(double x) //Differentiation of given function is 3x2+8x
{
double f;
f=(3*x*x)+(8*x);
return f;
}
main()
{
float x,xn,eps=0.00001;
printf("\nf(x)=x3-4x2-10");
printf("\nf'(x)=3x2-8x");
printf("\nenter value of x=");
scanf("%f",&x);
while(fabs(fx(x))>eps)
{
printf("pr");
xn=x-(fx(x)/fdx(x));
x=xn;
}
printf("%f\n",xn);
}