private ArrayList GetAvg(int[] arr, int n)
{
ArrayList arrAvg = new ArrayList();
for (int i = 0; i < arr.Length; i += n)
{
int x = 0;
for (int j = 0; j < n; j++)
{
if (i + j == arr.Length - 1 && j < n - 1)
{
n = j + 1;
}
x += arr[i + j];
}
x /= n;
arrAvg.Add(x);
}
{
ArrayList arrAvg = new ArrayList();
for (int i = 0; i < arr.Length; i += n)
{
int x = 0;
for (int j = 0; j < n; j++)
{
if (i + j == arr.Length - 1 && j < n - 1)
{
n = j + 1;
}
x += arr[i + j];
}
x /= n;
arrAvg.Add(x);
}
return arrAvg;
}
}