How do you calculate the arithmetic mean in each line of the matrix?

Remembrance is required for the matrix dynamically and complete. random numbers, calculate the arithmetic mean in each line of the matrix. The memory has given it, filled it with random numbers, how to calculate the average arithmetic line, I can't figure it out.
#include <iostream> #include <time.h> #include <windows.h> using namespace std;
int main(void)
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
int N;
int M;
int sum = 0;cout << "Введите количество строк матрицы: " << endl; cin >> N; cout << "Введите количество столбцов матрицы: " << endl; cin >> M; /*_____________________________*/ int **arr = new int*[N]; for (int i = 0; i < N; i++) { arr[i] = new int[M]; } /*_____________________________*/ for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { arr[i][j] = rand() % 20; } } /*_____________________________*/ for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { cout << arr[i][j] << "\t"; } cout << endl; } /*_____________________________*/ /*_____________________________*/ for (int i = 0; i < N; i++) { delete[] arr[i]; } delete[] arr; return 0;
}

MidArithmetic is the sum of all members divided by their colvo. Therefore:
float averageRow; for (int i = 0; i < N; i++) { averageRow = 0; for (int j = 0; j < M; j++) { averageRow += arr[i][j]; } averageRow /=M; cout <<"Average row " << i <<": " << averageRow << endl; }