Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include<iostream>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "RUS");
- int n, m, j, i, **arr, sum=0, sredn=0,k;
- cout << "Введите количество строк" << endl;
- cin >> n;
- cout << "Введите количество столбцов" << endl;
- cin >> m;
- arr = new int *[n];
- for (i = 0; i < n; i++)
- arr[i] = new int[m];
- for (i = 0; i < n; i++) {
- for (j = 0; j < m; j++)
- {
- cout << "a[" << i + 1 << "][" << j + 1 << "]=";
- cin >> arr[i][j];
- }
- }
- cout << "Введите значение числа К" << endl;
- cin >> k;
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- sum += arr[i][j];
- }
- sredn = sum / m;
- if (k > sredn) cout << "Среднее арифметическое " << i + 1 << " строки =" << sredn << endl;
- else cout << "Среднее арифметическое > числа К" << endl;
- }
- for (i = 0; i < n; i++)
- delete[]arr[i];
- delete[]arr;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment