// #1
#include
using namespace std;
int main() {
unsigned int n;
cout << "N = ";<br> cin >> n;
float a[n][n],
sum = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << "a[" << i<br> << "][" << j<br> << "] = ";<br> cin >> a[i][j];
sum += a[i][j];
}
}
float avg = sum / (n * n);
cout << "Среднее арифметическое - "<br> << avg << ", начинаю замену...\n";<br> for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (a[i][j] < 0) {
cout << "a[" << i<br> << "][" << j<br> << "] = " << a[i][j]<br> << " < 0, заменяю на "<br> << avg << "...\n";<br> a[i][j] = avg;
}
}
}
cout << "\nИзменённый массив:\n";<br> for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << a[i][j];<br> if ( !(j == n - 1) ) cout << ' ';<br> }
if ( !(i == n - 1) ) cout << '\n';<br> }
return 0;
}
// #2
#include
using namespace std;
const unsigned short int n = 7;
int main() {
int a[n][n],
max;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << "a[" << i<br> << "][" << j<br> << "] = ";<br> cin >> a[i][j];
}
}
max = a[0][0];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if ( (a[i][j] > max) && (i + j > n + 1) )
max = a[i][j];
}
}
cout << "Максимум ниже побочной диагонали: "<br> << max;<br> return 0;
}