Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "rus");
- int a[10][10], n;
- cout << "Введите n: ";
- cin >> n;
- cout << "Введите матрицу порядка " << n << ":\n";
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {
- cin >> a[i][j];
- }
- }
- int sum = 0;
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {
- if ((i > j) && (a[i][j] > 0))
- {
- sum += a[i][j];
- }
- }
- }
- cout << endl << sum << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment