Daniel_leinaD

лаба инфа 2.2

Mar 20th, 2022
877
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <clocale>
  3. using namespace std;
  4.  
  5. int main() {
  6.     setlocale(LC_ALL, "Rus");
  7.     int A[10][12], i, j;
  8.     for (i = 0; i < 10; i++) {
  9.         cout << endl;
  10.         if (i == 5) {
  11.             cout << endl;
  12.         }
  13.         for (j = 0; j < 12; j++) {
  14.             A[i][j] = rand() % 100 - 50;
  15.             cout << A[i][j]<<' ';
  16.         }
  17.     }
  18.     cout << endl;
  19.     int q = 0;
  20.     for (i = 6; i < 12; i++) {
  21.         for (j = 0; j < 12; j++) {
  22.             if (A[i][j] > 0) {
  23.                 q++;
  24.             }
  25.         }
  26.     }
  27.     cout << q << endl;
  28.     int B[6], q1 = 0;
  29.     for (j = 0; j < 12; j += 2) {
  30.         q1 = 0;
  31.         for (i = 0; i < 10; i++) {
  32.             if (A[i][j] < 0) {
  33.                 q1++;
  34.             }
  35.         }
  36.         cout << " " << q1;
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment