2022-03-17 10:59:47 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
float a[100],sum=0,x;
|
|
|
|
int n,i;
|
2022-03-17 11:02:36 +00:00
|
|
|
printf("\nEnter the value of X :: ");
|
|
|
|
scanf("%f",&x);
|
2022-03-17 10:59:47 +00:00
|
|
|
printf("\nEnter degree of the polynomial X :: ");
|
|
|
|
scanf("%d",&n);
|
|
|
|
printf("\nEnter coefficient's of the polynomial X :: \n");
|
|
|
|
for(i=n;i>=0;i--)
|
|
|
|
{
|
|
|
|
printf("\nEnter Coefficient of [ X^%d ] :: ",i);
|
|
|
|
scanf("%f",&a[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i=n;i>0;i--)
|
|
|
|
{
|
|
|
|
sum=(sum+a[i])*x;
|
|
|
|
}
|
|
|
|
|
|
|
|
sum=sum+a[0];
|
|
|
|
|
|
|
|
printf("\nValue of the polynomial is = [ %f ]\n",sum);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|