Advertisement
Josif_tepe

Untitled

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