Ответы
#include <iostream>
using namespace std;
void middle(int arr[5][5]) {
float length = 0, average = 0; int sum = 0;
const int a = 5; length = 0; sum = 0;
for (int i = 1; i<= a; i++) {
for (int j = 1; j<= a; j++) {
cin >> arr[i][j];
if (arr[i][j] % 5 == 0) {
length++;
sum+= arr[i][j];
average= sum / length;
}
}
}
cout << "Количество " << length << endl;
cout << "Сумма " << sum << endl;
cout << "Среднее арифметическое = " << average << endl;
}
int main() {
int arr[5][5];
middle(arr);
}
#include <iostream>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
int a[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> a[i][j];
}
}
int sum = 0, count = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (a[i][j] % 5 == 0) {
sum += a[i][j];
count++;
}
}
}
cout << sum / count << endl;
return 0;
}