Search:

# C Programming Articles

Submit Article

Posted By: Bittan Fischer     Category: C Programming     Views: 5974

## Code for Program of ADAMS-MOULTON METHOD in C Programming

```#include<stdio.h>
#include <math.h>
#include<conio.h>
#define F(x,y)  1 + (y)*(y)
void main()
{
double y0,x0,y1,y[10],n,h,f,sum=0;
int j;
clrscr();
printf("\nEnter the value of x0: ");
scanf("%lf",&x0);
printf("\nEnter the value of y0: ");
scanf("%lf",&y0);
printf("\nEnter the value of h: ");
scanf("%lf",&h);
printf("\nEnter the value of X for finding Y(x): ");
scanf("%lf",&n);
for(x0,j=0; x0<n; x0=x0+h,j++)
{
printf("\nEnter the value of Y(%.2lf): ",x0);
scanf("%lf",&y[j]);
}

f=F(x0,y[3]);
sum = sum + 55 * f;
f = F(x0,y[2]);
sum = sum - 59 * f;
f = F(x0,y[1]);
sum = sum + 37 * f;
f = F(x0,y[0]);
sum = sum - 9 * f;
y1 = y[3] + (h/24) * (sum);
printf("\n\n  Yp(%.2lf) = %.3lf ",n,y1);

sum = 0;
f = F(x0,y1);
sum = sum + 9 * f;
f=F(x0,y[3]);
sum = sum + 19 * f;
f = F(x0,y[2]);
sum = sum - 5 * f;
f = F(x0,y[1]);
sum = sum + f;
y1 = y[3] + (h/24) * (sum);
printf("\n\n  Yc(%.2lf) = %.3lf ",n,y1);

getch();
}

/*____________________________________         OUT PUT____________________________________Enter the value of x0: 0Enter the value of y0: 0Enter the value of h: 0.2Enter the value of X for finding Y(x): 0.8Enter the value of Y(0.00): 0Enter the value of Y(0.20): 0.2027Enter the value of Y(0.40): 0.4228Enter the value of Y(0.60): 0.6841  Yp(0.80) = 1.023  Yc(0.80) = 1.030*/```
Share:

Didn't find what you were looking for? Find more on Program of ADAMS-MOULTON METHOD Or get search suggestion and latest updates.

 Bittan Fischer author of Program of ADAMS-MOULTON METHOD is from Frankfurt, Germany. View All Articles

 Please enter your CommentComment should be atleast 30 Characters.Please put code inside [Code] your code [/Code]. No Comment Found, Be the First to post comment!