#include
#define N ...
#define M ...
#define _MIN(a, b) ((a) < (b) ? (a) : (b))
...
int
A[N][M],
sumOfDiagonal = 0,
sumOfEl = 0,
numOfEl = 0,
diagonalEl,
border,
i, j;
...
border = _MIN(N, M);
for (i = 0; i < border; i++)
sumOfDiagonal += A[i][i];
printf("Sum of the main diagonal elements = %i\n", sumOfDiagonal);
for (i = 0; i < border; i++)
{
diagonalEl = A[i][i];
for (j = 0; j < M; j++)
if (A[i][j] > diagonalEl)
sumOfEl += A[i][j], numOfEl++;
}
printf("The arithmetic mean of the elements = %f\n", (double)sumOfEl / numOfEl);
...