Advertisement
Josif_tepe

Untitled

Feb 13th, 2021
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define MAX 505
  4.  
  5. int main()
  6. {
  7.     int A[MAX][MAX], B[MAX][MAX];
  8.     int n;
  9.     scanf("%d%d", &n);
  10.     for(int i = 0; i < n; i++) {
  11.         for(int j = 0; j < n; j++) {
  12.             scanf("%d", &A[i][j]);
  13.         }
  14.     }
  15.     int glavna = 0;
  16.     for(int i = 0; i < n; i++) {
  17.         glavna += A[i][i];
  18.     }
  19.     int sporedna = 0;
  20.     for(int i = 0; i < n; i++) {
  21.         sporedna += A[i][n - i - 1];
  22.     }
  23.    
  24.     return 0;
  25. }
  26.  // niza={7,2,(15),0,3,13,5};
  27. // 7, 2, 0, 3, 5
  28.  
  29. /*
  30.  7, 2, 0, 0, 3, 0, 5
  31.  
  32.  
  33.  nova_niza = {7, 2, 0, 3, 5}
  34.  indeks = 5
  35.  
  36.  */
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement