Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int N = 3;
- const int P = 3;
- int main()
- {
- setlocale(LC_ALL, "RUS");
- int a[N][N];
- int sum[N] = { 0 };
- cout << "Введите элменты массива. Найти сумму положительных элементов строки " << endl;
- for (int i = 0; i < N; i++)
- {
- for (int j = 0; j < P; j++)
- {
- cin >> a[i][j];
- }
- cout << endl;
- }
- cout << "____________________________________" << endl;
- for (int i = 0; i < N; i++)
- {
- for (int j = 0; j < P; j++)
- {
- if (a[i][j] > 0)
- {
- sum[i] += a[i][j];
- }
- cout << a[i][j] << " ";
- }
- cout << endl;
- }
- cout << endl;
- for (int j = 0; j < P; j++)
- {
- cout << "Сумма положительных элементов столбца матриц равна = ";
- cout << sum[j] << " " << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement