#include
#include
using namespace std;
void randMas(int **a, int n, int m)
{
srand(time(0));
for(int i=0; i
for(int j=0; j
a[i][j] = rand() %10 + 1;
}
int sumItemOnMain(int **a, int n, int m)
{
int p,sum = 0;
if (n
p=n;
else
p=m;
for(int i; i
sum+=a[i][i];
return sum;
}
int main()
{
int n,m,sum;
cin>>n>>m;
int** Mas = new int *[n];
for (int i = 0; i < n; i++)
Mas[i] = new int [m];
randMas(Mas,n,m);
sum = sumItemOnMain(Mas,n,m);
cout<<sum;</strong>
return 0;
}