Polynomial Evaluation C Program : 











Common exponent terms will be added together and if nothing is common then the size of this polynomial is = total no. of terms of 1st polynomial + total no. of terms of 2nd polynomial.

Polynomial addition in C using arrays. This program shows the implementation of polynomial addition using arrays.
The program expects the user to enter the polynomial with integer exponent term while it supports floating value for coefficient terms.The program takes the values for the polynomial terms in the descending order,starting from the highest degree terms in the beginning and lowest degree terms in the end.




Polynomial Evaluate C Program:


#include<stdio.h>
#include<conio.h>
#include<math.h>
int eval(int a[],int n,int x)
{
int i;
double p,sum=0;
for(i=n;i>=0;i--)
{
p=pow(x,i);
sum=sum+a[i]*p;
}
return sum;
}
void main()
{
int a[10],n,c,i,e,x;
printf("Enter The Degrre Of Polynomial:");
scanf("%d",&n);
printf("\nEnter The Coefficient:");
for(i=n;i>=0;i--)
{
printf("\nEnter Coefficient A[%d]",i);
scanf("%d",&a[i]);
}
printf("\nEnter The Polynomial:");
for(i=n;i>=0;i--)
{
if(a[i]!=0)
printf("%dX^%d+",a[i],i);
}
printf("%d",a[i]);
printf("\nEnter The Value For X");
scanf("%d",&x);
e=eval(a,n,x);
printf("\n Evaluation Of Polynomial is=%d",e);
getch();
}

Thanks For Spending Your Time On My Site...