#include<stdio.h>
#include<malloc.h>
int horner(float coeff[], int n, int c)
main()
{
/* DICHIARAZIONE VARIABILI */
int n, i, c;
float *coeff;
coeff = (float *)malloc(n*sizeof(float));
/* LETTURA GRADO DEL POLINOMIO */
printf("Inserire il grado del polinomio");
scanf("%d", &n);
/* INSERIRE I VALORI DEI COEFF */
printf("Inserire uno ad uno i valori dei coefficienti a:");
for(i=0; i<=n; i++){
printf("Inserire il valore del coeff %d", i);
scanf("$f", &coeff[i]);
}
horner(coeff, n, c);
printf("%d",horner);
free(coeff);
}
int horner(float coeff[], int n, int c)
{
int i;
int horner;
horner = coeff[n];
for (i=n-1; i>=0; i--)
horner = horner * c + coeff[i];
return horner;
}