Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

N

/*****************PROGRAM OF NEWTON FORWARD INTERPOLATIO


*********************/

#include<stdio.h>
#include<conio.h>
void main()
{
int n,m,i,j;
float x[20],y[20] ,d[20][20];
clrscr();
printf("\nhow many values of x");
scanf("%d",&n);
printf("\nhow many values of y");
scanf("%d",&m);
printf("\nenter the values of x");
for(i=0;i< div="">
{
scanf("%f",&x[i]);
}
printf("\nenter the values of y");
for(i=0;i< div="">
{
scanf("%f",&y[i]);
}
printf("\ndifference table can be stored in%d by%d matrix",n-1,n-1);
printf("\n making forward difference table");
for(i=0;i< div="">
{
for(j=0;j< div="">
{
if(i==0)
{
d[j][i]=y[j+1]-y[j];
}
else
{
d[j][i]=d[j+1][i-1]-d[j][i-1];
}
}
}
for(i=0;i< div="">
{
printf("\t");
for(j=0;j< div="">
{
printf("\n%f",d[j][i]);
}
printf("\n\t");
}

getche();
}
<>
<>
<>
<>
<>
<>

You might also like