Question
Below is the code that you can modify: #include double evaluate(double p[], double x, int size) { double total = 0; int i = 0;
Below is the code that you can modify:
#include
double evaluate(double p[], double x, int size) {
double total = 0;
int i = 0;
double exp = 1;
while(i
total += p[i]*exp;
exp *= x;
i++;
}
return total;
}
int main() {
double arr[18];
int size, i, n;
printf("Enter degree of the polynomial: ");
scanf("%d", &n);
i = 0;
printf("Enter polynomial: ");
while(i
scanf("%lf", arr+i);
i++;
}
size = i;
printf("polynomial is %lf when x = 1 ", evaluate(arr, 1, size));
printf("polynomial is %lf when x = 3 ", evaluate(arr, 3, size));
printf("polynomial is %lf when x = -5 ", evaluate(arr, -5, size));
return 0;
}
Modify your program in 1 above (or write a new C program) to accept three polynomials as in problem 2. Now compute the polynomial P P, +P:+pg. Note that P(x)=-Py (Pi). Submit Similarly, (x) =
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started