Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int SIZE = 6;
- int main() {
- int arr[][SIZE]{
- {17, 6, 17, 8, 7, 17},
- {7, 5, 4, 65, 9, 48},
- {1, 1, 4, 0, 6, -96},
- {7, 3, 4, 5, 53, 0},
- {0, -1, 4, 5, 73, 14},
- {1, -2, 4, -5, 74, -9},
- };
- int sum = 0;
- cout << "->" << endl;
- for (int i = 0, j = sizeof(arr) / SIZE / sizeof(int) - 1; i < SIZE; ++i) {
- if (arr[j][i] > 0) {
- sum += arr[j][i];
- cout << i << " - " << j << endl;
- }
- }
- cout << "↑" << endl;
- for (int i = 0, j = SIZE - 1; i < sizeof(arr) / SIZE / sizeof(int) - 1; ++i) {
- if (arr[i][j] > 0) {
- sum += arr[i][j];
- cout << j << " - " << i << endl;
- }
- }
- cout << "sum: " << sum << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment