answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

#include<process.h>

#include<math.h>

void main()

{

int n;

int i,j;

float ax[10];

float ay[10];

float x;

float y=0;

float h;

float p;

float diff[20][20];

float y1,y2,y3,y4;

clrscr();

printf("\t\t!! NEWTON GRAGORY FORWARD INTERPOLATION FORMULA!!\n");

printf("\t\t By KRISHAN \t\t\n");

printf("\t\t enter the no of terms ->");

scanf("%d",&n);

printf("\n\t\t enter the value in form of x->");

for(i=0;i<n;i++)

{

printf("\n\t\t enter the value of x%d->",i+1);

scanf("%f",&ax[i]);

}

printf("\n\t\tenter the value in the form of y->");

for(i=0;i<n;i++)

{

printf("\n\t\tenter the value of y %d->",i+1);

scanf("%f",&ay[i]);

}

printf("\n\t\tenter the value of x for");

printf("\n\t\t which u want the value of y->");

scanf("%f",&x);

h=ax[1]-ax[0];

for(i=0;i<n-1;i++)

diff[i][1]=ay[i+1]-ay[i];

for(j=2;j<=4;j++)

for(i=0;i<n-j;i++)

diff[i][j]=diff[i+1][j-1]-diff[i][j-1];

do

{

i++;

}

while(ax[i]<x);

i--;

p=(x-ax[i])/h;

y1=p*diff[i-1][1];

y2=p*(p+1)*diff[i-1][2]/2;

y3=p*(p+1)*(p-1)*diff[i-2][3]/6;

y4=(p+2)*(p+1)*p*(p-1)*diff[i-3][4]/24;

y=ay[i]+y1+y2+y3+y4;

printf("\n\t\t when x=%6.4f,y=%6.8f",x,y);

printf("\n\n\n\t\t\t!! PRESS ENTER TO EXIT!!");

getch();

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

What is the meaning of a backward c then an o then a c?

The backward c, followed by an o and then a regular c can represent the word &quot;cool&quot; in text messaging or informal communication.


What does 3.78 liters equal?

It will weigh between 355.4 Newtons (at 100 deg C) and 370.8 Newtons (at 4 deg C).


What words can have a somewhat negative connotation a comparative b rabble c hack or d backward?

backward


How do you write a backward c for roman numeral?

Courtney


What is the difference between forward slash and backward slash in c?

forward slash - division operator backward slash - special character (e.g. \n - newline) in C strings


What is a backwards L forward C backward C forward L mean in numbers?

In numbers, a &quot;backwards L&quot; typically represents the number 7, a &quot;forward C&quot; represents the number 3, and a &quot;backward C&quot; represents the number 6. A &quot;forward L&quot; can represent the number 1. Therefore, the sequence &quot;backwards L forward C backward C forward L&quot; translates to 7, 3, 6, 1.


What is the name of the fashion line with a D and backward D logo?

it is actually a D and a backward C. But its called DC its a skater brand.


C program was introduced in the year?

c program was introduced in the year 1972 by Dennis RitchieNo, it was the C language, not the C program.


Features of c program?

the features of a C program


What is executive a c program?

I think it is 'execution of a C program'.


C program on left factoring in compiler design?

how to create a c program for left factoring.


Program for sin series in c language?

find the program in c-pgms.blogspot.com