Implement Newton-Raphson Method using C



Implement Newton-Raphson Method using C,Sumit Kar, Numerical Methods, C, Timus Rak




/*


Method of Newton-Raphson



Equation: x^3-4x-9=0


*/

#include<stdio.h>

void main()
{
float a,h;
int i;
float f(float);
float f1(float);
printf("\nEnter initial value:: ");
scanf("%f",&a);
for(i=1;i<=5;i++)
{
h=-f(a)/f1(a);
a=a+h;
}
printf("\nRoot is:: %f",a);
}
float f(float x)
{
return (x*x*x)-(4*x)-9;
}
float f1(float x)
{
return (3*x*x)-4;
}


Comments

Popular posts from this blog

Write a Program to Add two 3x3 Matrix using C

C program for Unit Conversion

Write a Program to Add two 5x5 Matrix using C