#include<stdio.h>
#include<math.h>
int main()
{
float x[25], y[25], ques, ans, a, b, h;
int i, j , num;
printf("Enter the Number of elements:");
scanf("%d",&num);
printf("Enter the elements of x:");
for(i=1 ;i<=num; i++)
{
scanf("%f",&x[i]);
}
printf("Enter the elements of y:");
for(i=1;i<=num;i++)
{
scanf("%f",&y[i]);
}
h=x[2]-x[1];
printf("Enter the value you want to find: ");
scanf("%f", &ques);
a=(ques-x[1])/h;
b=1;
ans=y[1];
for(i=1; i<=(num-1); i++)
{
for(j=1; j<=(num-i); j++)
{
y[j]=y[j+1]-y[j];
}
b=b*(a-i+1)/i;
ans=ans+b*y[1];
}
printf("Answer is %6.5f", ans);
return 0;
}
#include<math.h>
int main()
{
float x[25], y[25], ques, ans, a, b, h;
int i, j , num;
printf("Enter the Number of elements:");
scanf("%d",&num);
printf("Enter the elements of x:");
for(i=1 ;i<=num; i++)
{
scanf("%f",&x[i]);
}
printf("Enter the elements of y:");
for(i=1;i<=num;i++)
{
scanf("%f",&y[i]);
}
h=x[2]-x[1];
printf("Enter the value you want to find: ");
scanf("%f", &ques);
a=(ques-x[1])/h;
b=1;
ans=y[1];
for(i=1; i<=(num-1); i++)
{
for(j=1; j<=(num-i); j++)
{
y[j]=y[j+1]-y[j];
}
b=b*(a-i+1)/i;
ans=ans+b*y[1];
}
printf("Answer is %6.5f", ans);
return 0;
}
Nsutoatka Latrice Johnson Kerish Doctor
ReplyDeleteDriver Genius
FastStone Capture
delatotless
flexricon-ko Carlos Ruiz
ReplyDeleteThis is there
carnidoma