C code for Newton Raphson Method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CinnamonStix
    New Member
    • May 2019
    • 1

    #1

    C code for Newton Raphson Method

    Hey all! I'm trying to write a code for the Newton Raphson method in C.

    I'm very new to coding and can't figure out how to make a loop to change my x0 into x1 for the next iteration.

    Any help is appreciated! Thank you!
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 656

    #2
    What do you mean by x0 and x1?

    If they are variables, you can use array to store values in a continuous manner.
    Code:
    for(int i=0; i<n; i++)
      scanf("%d", &x[i]);
    Here: x0, x1, x2 etc. will hold same types of values.
    -------------------------------

    If you mean that as a multiplication sign,

    Code:
    while(condition){
       value = value x i;
       i=i+1;
    }
    Initialise the values of 'i' and 'values' accordingly.

    Comment

    Working...