Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
503 B
1
Indexable
Never
#include <stdio.h>

int main(){
	int n,;
	printf("Enter the number of points:");
	scanf("%d",&n);
	int x;
	printf("Enter the interpolated value of x:");
	scanf("%d",&x);
	for (int i=0;i<n-1;i++){
		dd[i]=fx[i];
		
	}
	for (int i=0;i<n-1;i++){
		for (int j=n-1;j<i+1;j++){
			dd[j]=(dd[j]-dd[j-1])/(x[j]-x[j-1-i]);
		}
	}
	int v=0,p=1;
	for(int i=0;i<n-1);i++){
		for (int j=0,j<i-1;j++){
			p=p*(x-xj);
		}
		v=v+dd[i]*p;
		p=1;
	}
	printf("The interpolated value v is ",v);
}