Advertisement
Josif_tepe

Untitled

Apr 2nd, 2021
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int n, m;
  7.     cin >> n >> m;
  8.     int matrica[n][m];
  9.     for(int i = 0; i < n; i += 1) {
  10.         for(int j = 0; j < m; j += 1) {
  11.             cin >> matrica[i][j];
  12.         }
  13.     }
  14.    
  15.     for(int i = 0; i < n; i += 1) {
  16.         for(int j = 0; j < m; j += 1) {
  17.             if(i == j) {
  18.                 cout << matrica[i][j] << " ";
  19.             }
  20.         }
  21.     }
  22.    
  23.     return 0;
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement