Newton Raphson Method usng C Programming

Newton Raphson Method usng C Programming:

#include<stdio.h>#include<math.h>#define e 0.001#define f(x)  (x*x*x*x-x-10)#define df(x) (4*x*x*x-1)int main(){    int i;    float x0,x1,f1;    i=0;    printf("Enter the value of x0");    scanf("%f",&x0);    do    {        x1=x0-((f(x0))/(df(x0)));        f1=f(x1);        x0=x1;        i++;        printf("The Number of Iteration is %d and Value of Function is %f and value of x is %f\n",i,f1,x0);    }    while(fabs(f1)>e);    return 0;}


Comments

Popular posts from this blog

Newton Backward Interpolation Formula