fork(1) download
  1. #include <iostream>
  2. #include <cmath> // dla funkcji pow()
  3.  
  4. int main() {
  5. // Dane
  6. int a3 = 2, a2 = 3, a1 = 4, a0 = 5;
  7. int x = 3;
  8.  
  9. // Obliczanie wartości wielomianu metodą naiwną
  10. int W = a3 * pow(x, 3) + a2 * pow(x, 2) + a1 * pow(x, 1) + a0;
  11.  
  12. std::cout << "W(" << x << ") = " << W << std::endl;
  13.  
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
W(3) = 98