Newton Raphson Method C Program

By | June 22, 2017

Let us learn how to implement Newton Raphson method in C programming with its explanation, advantages, output and much more.

What is Newton-Raphson’s Method?

The newton raphson algorithm is one of the most popular root-finding methods. So, it is basically used to find roots of a real-valued function.

This method is named after Isaac Newton and Joseph Raphson and is used to find a minimum or maximum of a function.

The Newton’s method is a better approximation method as compared to some other numerical methods. It is based on the idea of simple linear approximation.

This is a one-point method since it requires only one starting value and does not need to satisfy any other serious conditions.

Newton-Raphson Formula

Formula for Newton-Raphson Method

Newton-Raphson Algorithm

Step 1: Calculate values of derived_function(value) and function(value)
Step 2: Calculate m = function(value) / derived_function(value)
Step 3: While m is greater than the allowed error
              m = function(value) / derivfunction(value)
Step 4: value = value - m
Step 5: Evaluated Result

Flowchart For Newton – Raphson Method

Newton Raphson Method Flowchart in Numerical Methods

Advantages of Newton Raphson Method

  • The number of significant digits doubles after every iteration which brings us more closer to the root.
  • The Newton – Raphson method converges faster than Bisection method and False Position Method.
  • This method converges quadratically on the root which enables this algorithm to deal with the higher degree of variable involved.

Note: This C program for Newton – Raphson method in numerical analysis is compiled with GNU GCC compiler using CodeLite IDE on Microsoft Windows 10 operating system.

C Program For Newton Raphson Method


float allowed_error = 0;

double function(double value);
double derived_function(double value);
void newton_raphson_method(double value);

int main()
      double value;
      printf("\nEnter a Value:\t");
      scanf("%lf", &value);
      printf("\nEnter Allowed Error:\t");
      scanf("%f", &allowed_error);
      return 0;

void newton_raphson_method(double value)
      double m = function(value) / derived_function(value);
      for ( ;abs(m) >= allowed_error; )
            m = function(value) / derived_function(value);
            value = value - m;
      printf("\nRoot Value:\t%f\n", value);

double function(double value)
      return (value * value * value - value * value + 2);

double derived_function(double value)
      return (3 * value * value - 2 * value);


C Program For Newton Raphson Method in Numerical Methods

If you have any doubts about the implementation of Newton Raphson rule formula in C programming, let us know about it in the comment section. Find more about it on Wikipedia.

Weddle’s Rule Algorithm C Program
Euler’s Method C Program
Secant Method C Program
Bisection Method C Program
Gauss Seidel Method C Program
Simpson’s 3/8th Rule C Program
Picard’s Method C Program
Regula Falsi Method C Program
Bisection Method Algorithm and Flowchart
Simpson’s 1/3rd Rule C Program
Trapezoidal Rule C Program

Let's Discuss