Полином
помогите исправить кодировку. решение не так выдает
#include <stdio.h> #include <math.h> double I(int i, int n, double x, double X[5], double Y[5]){ int j; double ch=1,zn=1; n=5; for (j=0; j<n; j++){ if(i==j) continue; ch*=x-X[j]; zn*=X[i]-X[j]; printf("ch=%f\n zn=%f\n",ch,zn); } return Y[i]*ch/zn; } int main(){ double e,x; int i,n; double X[5]={0,1,2,3,4}; double Y[5]={2,0,0,2,6}; scanf("%d",&i); e=I(i,5,-1,X,Y); printf("Reshenie polinom I(i)=%lf",e); } |
Часовой пояс GMT +4, время: 19:57. |
Powered by vBulletin® Version 4.5.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.