Advertisement
Josif_tepe

Untitled

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