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

Comments

Popular posts from this blog

cpanel exam CPSP Answers

How to install zimbra collaboration suite 8.8.11 on CentOS 7

awstats installation