1、#include#include#define N 6float sub(float a,float b,float x,float e);void main(void)float uN=100,121,144,169,196,225;float vN=10,11,12,13,14,15;float x,y,e,*p1,*p2;printf(“Input number x E=:“);scanf(“%f%e“,p1=u;p2=v;y=sub(p1,p2,x,e);printf(“y=%fn“,y);float sub(float *pp1,float *pp2,float x,float e)
2、float aN,bN,tN,y,y1,c;int i,k;for(i=0;iN;i+,pp1+)ai=*pp1;printf(“%12.6f“,ai);printf(“n“);for(i=0;iN;i+,*pp2+)bi=*pp2;printf(“%12.6f“,bi);printf(“n“);y1=b0;y=0;c=1.0;for(k=1;kN;k+)for(i=k;iN;i+)ti=(bi-bi-1)/(ai-ai-k); /t 数组保存差商c=c*(x-ak-1);y1=y1+c*tk;if(fabs(y-y1)e)break;y=y1;for(i=k;iN;i+)bi=ti;return(y);