example:
the order of polynomial is 3rd
the constants are 1,2,3,4
x=3
1(3)^3+2(3)^2+3(3)^1+4=58
but the program will only print
1(3)^3+2(3)^2+4=49
Code:
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <stdlib.h>
main(){
double poly[11];
double polysum;
int n, i, x, y, z;
printf("Enter the order of polynomial: ");
scanf("%d", &n);
y=n;
z=n;
for (i = 0; i < y+1; i++){
printf("Please enter the constant for x raised to the %dth: ", y--);
scanf("%lf", &poly[i]);
}
printf("Please enter the constant for x raised to the 0th: ");
scanf("%lf", &poly[10]);
printf("Enter the value of X: ");
scanf("%d", &x);
for (i = 0; i < n+1; i++){
polysum+=poly[i]*pow(x,n);
n--;
}
polysum=polysum+poly[10];
printf("The evaluated value of the %dth Order Polynomial %lf\n", z, polysum);
getche();

