Posts

Showing posts with the label raphson method

c programming for raphson method

#include<stdio.h> #include<math.h> #define f(x) (3*x*x+2*x-9) #define df(x) (6*x+2) void main() { float x,a,c; printf("\n Enter the value initial value of x\n"); scanf("%f",&x); do { c=(-f(x)/df(x)); x=x+c; } while (fabs(c)>0.0001); printf("\n The value of the root is=%f",x); } output:- Enter the initial value of x The value of the root is =1.430501