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