By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

C code for Newton Raphson Method

P: 1
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!
1 Week Ago #1

✓ answered by dev7060

What do you mean by x0 and x1?

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

If you mean that as a multiplication sign,

Expand|Select|Wrap|Line Numbers
  1. while(condition){
  2.    value = value x i;
  3.    i=i+1;
  4. }
  5.  
Initialise the values of 'i' and 'values' accordingly.

Share this Question
Share on Google+
1 Reply


P: 60
What do you mean by x0 and x1?

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

If you mean that as a multiplication sign,

Expand|Select|Wrap|Line Numbers
  1. while(condition){
  2.    value = value x i;
  3.    i=i+1;
  4. }
  5.  
Initialise the values of 'i' and 'values' accordingly.
1 Week Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.