#include
#include
#define max 90
void main()
{
float a[max+1],b[max+1],num,den,x,y=0;
int i,j,n;
clrscr();
printf("enter n value:");
scanf("%d",&n);
printf("Enter values of x,y");
for(i=0;i<=n;i++)
scanf("%f %f",&a[i],&b[i]);
printf("Enter value of x at which value of y is to be calculated");
scanf("%f",&x);
for(i=0;i<=n;i++)
{
num=1;
den=1;
for(j=0;j
{
num*=x-a[j];
den*=a[i]-a[j];
}
y+=(num/den)*b[i];
}
printf("when x=4.1f | y=7.1f\n", x,y);
getch();
}
No comments:
Post a Comment