Code:

#include<stdio.h>
#include<conio.h>
void main()
{
float x[20],fx[20],p[20]={1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0};
int i,n,j;
float a,b;
float z;
float sum=0.0;
clrscr();
printf("Enter the number of interpolating points ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nEnter the values of x and f(x) ");
scanf("%f %f",x[i],fx[i]);
}
printf("\nEnter the value at which you wish to find the values of Lagrangee's polynomial ");
scanf("%f",&z);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(i==j)
j++;
a=(z-x[i+j]);
b=(x[i]-x[i+j]);
p[i]=p[i]*(a/b);
}
}
for(i=0;i<n;i++)
{
sum=sum+p[i]*fx[i];
}
printf("%f",sum);
getch();
}

This program is showing no compilation and linking error but showing

"Floating point errorivide by 0

Null pointer assignment"

Why is it so?

Please help in finding out the error.

Please reply quickly...