Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://vk.com/evgenykravchenko0
- ___ ___ ___
- / /\ ___ / /\ / /\
- / /:/_ /__/\ / /:/_ / /:/_
- / /:/ /\ \ \:\ / /:/ /\ / /:/ /\
- / /:/ /:/_ \ \:\ / /:/_/::\ / /:/ /:/_
- /__/:/ /:/ /\ ___ \__\:\ /__/:/__\/\:\ /__/:/ /:/ /\
- \ \:\/:/ /:/ /__/\ | |:| \ \:\ /~~/:/ \ \:\/:/ /:/
- \ \::/ /:/ \ \:\| |:| \ \:\ /:/ \ \::/ /:/
- \ \:\/:/ \ \:\__|:| \ \:\/:/ \ \:\/:/
- \ \::/ \__\::::/ \ \::/ \ \::/
- \__\/ ~~~~ \__\/ \__\/
- ___
- /__/\ ___ ___
- \ \:\ / /\ / /\
- \ \:\ / /:/ / /:/
- _____\__\:\ /__/::\ /__/::\
- /__/::::::::\ \__\/\:\__ \__\/\:\__
- \ \:\~~\~~\/ \ \:\/\ \ \:\/\
- \ \:\ ~~~ \__\::/ \__\::/
- \ \:\ /__/:/ /__/:/
- \ \:\ \__\/ \__\/
- \__\/
- #include <stdio.h>
- int main()
- {
- int n;
- int i;
- int j;
- int step = 0;
- int l;
- int m;
- int max = 0;
- int sum = 0;
- printf("Введите размерность матрицы = ");
- scanf("%d", &n);
- printf("Матрица размером %d на %d \n", n, n);
- int a[n][n];
- printf("Введите элементы матрицы : \n");
- for (i = 0;i < n;i++)
- for(j = 0; j < n;j++)
- scanf("%d", &a[i][j]);
- for (l = 0; l < n - 1; l++)
- {
- for (i = step + 1, j = 0; i < n;i++,j++)
- {
- sum = sum + a[i][j];
- if (sum > max)
- max = sum;
- }
- sum = 0;
- step++;
- }
- step = 0;
- for (l = 0; l < n - 1; l++)
- {
- for (i = 0, j = step + 1; j < n ; i++,j++)
- {
- sum = sum + a[i][j];
- if (sum > max)
- max = sum;
- }
- sum = 0;
- step++;
- }
- printf(" max = %d", max);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement