Advertisement
desislava_shunina

Task_6

Oct 23rd, 2022
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | Source Code | 0 0
  1. #include <iostream>
  2. int main() {
  3.     int a, b, c, d, e;
  4.     int counter = 0;
  5.     std::cin >> a >> b >> c >> d >> e;
  6.     for (int x = -100; x <= 100; x++) {
  7.         int valueOfExpr = a * x * x * x * x + b * x * x * x + c * x * x + d * x + e;
  8.         if (valueOfExpr >= 0) {
  9.             std::cout << x << " ";
  10.             counter += 1;
  11.         }
  12.     }
  13.     if (counter == 0) {
  14.         std::cout << "There are no roots in the interval [-100; 100].";
  15.     }
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement