How to resolve a polynomial function.

How to resolve a polynomial function.
Example in 3 elements. 
F(x) =x^n+a_(n-1)*x^(n-1)+... +a1*x+a0

#include <stdio.h >
#include <math.h >
int main()
{
  int f, n, a[3],x;
  printf("Insert 3 elements (a) :") ;
  for(i =1;i<=3;i++)
   {
     scanf("%i", a[i]) ;
   }
   printf("\nInsert n elements :") ;
   scanf("%i", n) ;
   printf("\nInsert x variable :") ;
   scanf("%i", x) ;
   for(i=1;i<=3;i++)
   {
   f+=pow(x, n) +a[n-1]*pow(x,n-1);
   n-=1;
   }
   f+=a[0];
  printf("\nThe result of polynomial function is:%i", f) ;
 return 0 ;
}

#c #unix #linux #ethicalhacker #math #mathematics #Physics
#programming

Commenti

Post popolari in questo blog