3. Write a program that asks the user to enter a value for x and then displays the value of the following polynomial 2x^5+3x^4-x^3-2x^2+7x-
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float x;
cout <<"Please, enter a value of x: ";
cin >> x;
cout << "2x^5 + 3x^4 - x^3 - 2x^2 + 7x = "
<< 2 * pow(x, 5) + 3 * pow(x, 4) - pow(x, 3) - 2 * pow(x, 2) + 7 * x;
}
Comments
Leave a comment