Advertisement
Josif_tepe

Untitled

Aug 23rd, 2021
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4.  
  5. int main(){
  6.     int n;
  7.     scanf("%d", &n);
  8.    
  9.     int matrica[n][n];
  10.     for(int i = 0; i < n; i++) {
  11.         for(int j = 0; j < n; j++) {
  12.             scanf("%d", &matrica[i][j]);
  13.         }
  14.     }
  15.     printf("Glavna dijagonala: ");
  16.     for(int i = 0; i < n; i++) {
  17.         printf("%d ", matrica[i][i]);
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement