int main() { int n; std::cout << "n = "; std::cin >> n; float* a = new float[n]; for (int i = 0; i < n; i++) { std::cout << "a[" << i << "] = "; std::cin >> a[i]; } std::cout << "x = "; int x; std::cin >> x;
float result = 0; int xpower = 1; for (int i = n-2; i >= 0; i--) { result += a[i] * x * xpower; xpower *= x; } result += a[n-1]; std::cout << "WYNIK: " << result; }
int main()
{
int n;
std::cout << "n = ";
std::cin >> n;
float* a = new float[n];
for (int i = 0; i < n; i++)
{
std::cout << "a[" << i << "] = ";
std::cin >> a[i];
}
std::cout << "x = ";
int x;
std::cin >> x;
float result = 0;
int xpower = 1;
for (int i = n-2; i >= 0; i--)
{
result += a[i] * x * xpower;
xpower *= x;
}
result += a[n-1];
std::cout << "WYNIK: " << result;
}