using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace avg_sort
{
class Program
static void Main(string[] args)
const int N = 10;
int[] Arr = new int[N];
Random rand = new Random();
Console.Write("Исходный массив: ");
for (int k = 0; k < N; ++k)
Arr[k] = rand.Next() % 100;
Console.Write("{0} ", Arr[k]);
}
Console.WriteLine();
double avg = Arr.Average();
int[] Bufer = new int[N];
int i = 0, j = N - 1;
Console.WriteLine("Среднее значение по массиву Avg = {0}", avg);
if (Arr[k] > avg)
Bufer[i] = Arr[k];
i++;
} else
Bufer[j] = Arr[k];
j--;
Arr = Bufer;
Console.Write("Отсортированный массив: ");
foreach (var el in Arr)
Console.Write("{0} ", el);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace avg_sort
{
class Program
{
static void Main(string[] args)
{
const int N = 10;
int[] Arr = new int[N];
Random rand = new Random();
Console.Write("Исходный массив: ");
for (int k = 0; k < N; ++k)
{
Arr[k] = rand.Next() % 100;
Console.Write("{0} ", Arr[k]);
}
Console.WriteLine();
double avg = Arr.Average();
int[] Bufer = new int[N];
int i = 0, j = N - 1;
Console.WriteLine("Среднее значение по массиву Avg = {0}", avg);
for (int k = 0; k < N; ++k)
{
if (Arr[k] > avg)
{
Bufer[i] = Arr[k];
i++;
} else
{
Bufer[j] = Arr[k];
j--;
}
}
Arr = Bufer;
Console.Write("Отсортированный массив: ");
foreach (var el in Arr)
{
Console.Write("{0} ", el);
}
Console.WriteLine();
}
}
}