Explicație:
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("matrice.in");
ofstream fout("matrice.out");
int main()
{
int a[10][10],m,n,suma,k;
fin>>m;
fin>>n;
suma=0;
k=0;
for(int i=0;i<m;i++)
for(int j=0;j<n;j++)
{
fin>>a[i][j];
if(a[i][j]>0)
{
suma=suma+a[i][j];
k++;
}
}
if(k==0)
fout<<"NU";
else
fout<<(1.0*suma)/k;
fin.close();
fout.close();
return 0;
}