Advertisement
Josif_tepe

Untitled

Apr 17th, 2024
746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int n;
  5.     scanf("%d", &n);
  6.  
  7.     int mat[n][n];
  8.  
  9.     for(int i = 0; i < n; i++) {
  10.         for(int j = 0; j < n; j++) {
  11.             scanf("%d", &mat[i][j]);
  12.         }
  13.     }
  14.  
  15.     int zbir = 0;
  16.     for(int i = 0; i < n; i++) {
  17.         for(int j = n - i; j < n; j++) {
  18.             zbir += mat[i][j];
  19.         }
  20.     }
  21.     printf("%d\n", zbir);
  22.     return 0;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement