Advertisement
Guest User

Untitled

a guest
May 27th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #define MAX 100
  5.  
  6. int main() {
  7. int n;
  8. scanf("%d",&n);
  9. int rezultat=0;
  10. int i,j;
  11. int matrica[MAX][MAX];
  12. for(i=0; i<n; i++) {
  13. for(j=0; j<n; j++) {
  14. scanf("%d",&matrica[i][j]);
  15. }
  16. }
  17.  
  18. for(i=0; i<n; i++) {
  19. int zbir=0;
  20. for(j=0; j<n-i; j++) {
  21. zbir+=matrica[j][i+j];
  22. }
  23. if(zbir>rezultat) {
  24. rezultat=zbir;
  25. }
  26.  
  27. }
  28. printf("%d\n",rezultat);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement