Here is a 4X4 matrix randomly generated and between 0 and 9 :

Refresh to have a new matrix

2 8 4 9
6 5 9 8
4 7 8 1
2 8 9 3


The average of the first row is 5.75
The average of the second row is 7
The average of the third row is 5
The average of the fourth row is 5.5

The average of the first column is 3.5
The average of the second column is 7
The average of the third column is 7.5
The average of the fourth column is 5.25