Calculating the Numerical Value of a Polynomial in C
Calculate for a given value X of the type float the numerical value of a polynomial of degree nP(X) =

#include < stdio.h> #include < stdlib.h> #include < math.h> main() { float A[30]; int N; float X; float P; printf("Enter Degree" N of the polynomial (30 maximum): "); scanf("%d", & N); printf("Enter the value of the X variable: "); scanf("%f", & X); for (int i=0; i<=N ; i++) { printf("Enter the coefficient A %d: ", i); scanf("%f", & A[i]); } P=0.0; for (int i=0; i<=N ; i++) P += A[i]*pow(X,i); printf("Polynomial value for X = %.2f: %.2f\n", X, P); system("pause"); } |