#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
setlocale(0, "");
srand(time(0));
int arr[5][7];
float average = 0;
int counter = 0;
for(int i = 0; i<5; ++i) {
for(int j = 0; j<7; ++j) {
arr[i][j]=rand();
cout << arr[i][j] << " ";
if(j==6) {
cout << endl;
}
if(arr[i][j]>=0) {
average+=arr[i][j];
++counter;
cout << "Средний: " << average/counter;
system("pause");
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
setlocale(0, "");
srand(time(0));
int arr[5][7];
float average = 0;
int counter = 0;
for(int i = 0; i<5; ++i) {
for(int j = 0; j<7; ++j) {
arr[i][j]=rand();
cout << arr[i][j] << " ";
if(j==6) {
cout << endl;
}
if(arr[i][j]>=0) {
average+=arr[i][j];
++counter;
}
}
}
cout << "Средний: " << average/counter;
system("pause");
}