input, you are given an integer n, a double x, followed by n+1 doubles a_n, a_{n-1}, ..., a_0. You are to print the value of the polynomial a_0 + a_1x+a_2x^2+...+a_nx^n.
Here is the manual algorithm. At the beginning you just have read a_n. Next you read a_{n-1} and calculate a_nx+a_{n-1}. Next you read a_{n-2} and calculate (a_nx+a_{n-1})x+a_{n-2}. So after n iterations you will have the value of the polynomial above. Note that in each iteration you need to use the values calculated earlier.
Answers
Answered by
2
Answer:FROM WHICH CHAPTER ARE U ASKING THESE QUESTIONS MATHS OR COMPUTER SCIENCE MAKE YOURSELF CLEAR
Explanation:
CLS
INPUT "ENTER ANY INTEGER";N
LET A= BLAH BLAH BLAH
PRINT "THE ANSWER IS ";A
END
Answered by
1
Answer:
#include <iostream>
#include<cmath>
using namespace std;
int main()
{
int n;
double x;
double a_[50];
double sum=0;
cin>>n;
cin>>x;
for (int i=n;i>=0;i--)
{
cin>>a_[i];
sum=sum+(a_[i]*pow(x,i));
}
cout<<sum;
}
Explanation:
Similar questions