Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int m, n, sum;
- int amount = 0;
- cout << "vvedite N: "; cin >> n;
- cout << "vvedite M: "; cin >> m;
- int **arr = new int*[n];
- for (int i = 0; i < n; i++)
- {
- arr[i] = new int[m];
- }
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- cout << "a[" << i + 1 << "][" << j + 1 << "]= ";
- cin >> arr[i][j];
- }
- }
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- cout << arr[i][j] << " ";
- }
- cout << endl;
- }
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- if (arr[i][j]<0)
- {
- sum = arr[i][j];
- amount = 1;
- break;
- }
- break;
- }
- break;
- }
- if (amount == 0)
- {
- cout << "NETU" << endl;
- }
- else {
- sum = 0;
- amount = 0;
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- if (arr[i][j] < 0)
- {
- sum = sum + arr[i][j];
- amount = amount+ 1;
- }
- }
- }
- cout << " sum " << sum << endl;
- cout << " amount " << amount << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement