x2311

Untitled

Jan 12th, 2022
831
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. const int N = 4;
  6. const int M = 11;
  7.  
  8. int main() {
  9.     int arr[M][N]{
  10.             {8,  7,  5,  0},
  11.             {1,  3,  2,  -6},
  12.             {1,  32, 2,  0},
  13.             {7,  0,  3,  9},
  14.             {0,  3,  3,  -27},
  15.             {1,  3,  2,  1},
  16.             {-7, -1, 4,  -7},
  17.             {0,  3,  0,  83},
  18.             {1,  1,  32, 1},
  19.             {4,  4,  4,  4},
  20.             {0,  3,  1,  0}
  21.     };
  22.  
  23.     int x0 = 0;
  24.     int x_plas = 0;
  25.     int x_min = 0;
  26.  
  27.     for (int i = 0; i < M; ++i) {
  28.         if (arr[M][i] == 0) {
  29.             x0++;
  30.         } else if (arr[M][i] > 0) {
  31.             x_plas++;
  32.         } else {
  33.             x_min++;
  34.         }
  35.     }
  36.  
  37.     cout << endl;
  38.     cout << "0: ";
  39.     cout << x0;
  40.  
  41.     cout << endl;
  42.     cout << "+: ";
  43.     cout << x_plas;
  44.  
  45.     cout << endl;
  46.     cout << "-: ";
  47.     cout << x_min;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment