Untitled
unknown
plain_text
a year ago
764 B
1
Indexable
Never
#include <stdio.h> int main(){ int n,j,i; printf("Enter the number of points: "); scanf("%d",&n); float x[n],y[n]; for(i=0;i<n;i++){ printf("\n Enter data %d: ",i+1); scanf("%f",&x[i]); printf("Enter the corresponding value of data %d: ",i+1); scanf("%f",&y[i]); } float point; printf("\n Enter the value at which interpolated value is needed: "); scanf("%f",&point); float dd[n]; for(i=0;i<n;i++){ dd[i]=y[i]; } for(i=0;i<n;i++){ for(j=n-1;j>=i+1;j=j-1){ dd[j]= (dd[j]-dd[j-1])/(x[j]-x[j-1-i]); } } float vod = dd[1]; for(i=2;i<n;i++){ float term=0; for(j=0;i<=i;i++){ float factor=1; for(k=0;k<=i;k++){ if(j!=k) factor=factor*(x-x[k]); } term= } } }