


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



#include<stdio.h> #include<conio.h> #include<math.h> void main() { float xi[10]; float fi[10][10]; int n; float x, x0, h, k; float f1,f2,f3,f4,f5,f6; float fx_1, fx_2; int i, j; printf("Enter the degree of polynomial: "); scanf("%d", &n); printf("Enter the data set of x:\n"); for(i=0;i<n;i++) { scanf("%f", &xi[i]); } printf("Enter the data set of f(x):\n"); for(i=0;i<n;i++) { scanf("%f", &fi[0][i]); } for(i=1;i<n;i++) { for(j=0;j<n-i;j++) { fi[i][j] = (fi[i-1][j+1]-fi[i-1][j]); } } printf("\nDivided difference table:\n"); printf("df\td2f\td3f\td4f\td5f\td6f\n"); for(j=0;j<n;j++) { for(i=1;i<n-j;i++) { printf("%.4f\t", fi[i][j]);