Advertisement
Josif_tepe

Untitled

Mar 17th, 2021
121
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. #include <fstream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n, m;
  7.     cin >> n >> m;
  8.    
  9.     int mat[n][m];
  10.     for(int i = 0; i < n; i++) {
  11.         for(int j = 0; j < m; j++) {
  12.             cin >> mat[i][j];
  13.         }
  14.     }
  15.    
  16.     for(int i = 0; i < n; i++) {
  17.         for(int j = 0; j < m; j++) {
  18.             if(i == j) {
  19.                 cout << mat[i][j] << endl;
  20.             }
  21.         }
  22.     }
  23.     return 0;
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement