Professional Documents
Culture Documents
Newton Backward Interpolation
Newton Backward Interpolation
Flowchart
Start
False
h = x[2] x[1]
read f
s = f(x[n])/h
d = y[n]
p=1
False
print f, d
Stop
False
Program
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
main()
{
float x[20],y[20],f,s,d,h,p;
int j,i,k,n;
clrscr();
printf ("*\n"); //(57 *s)
printf ("*\t\tBackward Interpoaltion\t\t\t*\n");
printf ("*\n\n"); //(57 *s)
printf("How many record you will be enter:");
scanf("%d",&n);
printf("enter the value of x: \n\n");
for(i=1;i<=n;i++)
{
scanf("%f",&x[i]);
}
printf("enter the value of y: \n\n");
for(i=1;i<=n;i++)
{
scanf("%f",&y[i]);
}
h=x[2]-x[1];
printf("enter the searching point f:");
scanf("%f",&f);
s=(f-x[n])/h;
d=y[n];
p=1;
for(i=n,k=1;i>=1,k<n;i--,k++)
{
for(j=n;j>=1;j--)
{
y[j]=y[j]-y[j-1];
}
p=p*(s+k-1)/k;
d=d+p*y[n];
}
printf("\n*//(25 *s)THE RESULT*//(24 *s)\n");
printf("for f=%f ,ans is=%f",f,d);
getch();
return 0;
}
Output