Advertisement
Urchin99

5.4

Feb 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. setlocale(0, ".1251");
  2.  
  3.     const int n = 5;
  4.     int arr[n][n];
  5.     for (int i = 0; i<n; i++) {
  6.         for (int j = 0; j<n; j++) {
  7.             arr[i][j] = rand() % 10;
  8.             cout << arr[i][j] << " ";
  9.         }
  10.         cout << "\n";
  11.     }
  12.     cout << "Вектор главной диагонали : ";
  13.     for (int i = 0; i<n; i++)
  14.         for (int j = 0; j<n; j++)
  15.             if (i == j)
  16.                 cout << arr[i][j] << " ";
  17.     cout << endl;
  18.         system("pause");
  19.     return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement