Advertisement
Josif_tepe

Untitled

Aug 19th, 2021
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4.  
  5. int main(){
  6.  
  7.     int n;
  8.     scanf("%d", &n);
  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. }
  21.  
  22. /*
  23.  4
  24.  88 71 24 77
  25.  71 32 48 32
  26.  50 7 39 92
  27.  19 64 23 1
  28.  
  29.  5
  30.  1 2 3 4 5
  31.  6 7 8 9 10
  32.  11 12 13 14 15
  33.  16 17 18 19 20
  34.  21 22 23 24 25
  35.  **/
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement