Другие языки программирования и технологии

Помогите пожалуйста написать программу на C#

Дан массив целых чисел. Не используя нового массива,
разместить элементы массива так, чтоб сначала шли все элементы, равные
нулю, а потом – остальные.
Очень срочно!!! Пожалуйста помогите!
using System;
using System.Collections;
namespace Answer {
public class Comparer : IComparer {
public int Compare(object x, object y) {
if ((int)x != 0 && (int)y == 0) return 1;
if ((int)x == 0 && (int)y != 0) return -1;
return 0;
}
}
class Program {
static void Main() {
const int n = 25;
var rand = new Random();
var box = new int[n];
for (var i = 0; i < n; ++i) box[i] = rand.Next(-2, 3);
foreach (var x in box) Console.Write($"{x,3}");
Console.WriteLine();
IComparer comparer = new Comparer();
Array.Sort(box, comparer);
foreach (var x in box) Console.Write($"{x,3}");
Console.WriteLine();
Console.ReadKey();
}
}
}
ЮЧ
Юрий Чернышёв
71 191
Лучший ответ
using System;
namespace q221946067
{
 class Program
 {
  public static void Main(string[] args)
  { 
   Random rand = new Random();
   int[] n = new int[rand.Next(10, 20)];
   for(int i = 0; i < n.Length; ++i){
    n[i] = rand.Next(-5, 5);
    Console.Write("{0,3}", n[i]);
   }
   Console.WriteLine();
   for(int i = 0, p = 0; i < n.Length; ++i)
    if(n[i] == 0){
     n[i] = n[p];
     n[p++] = 0;
    }
   for(int i = 0; i < n.Length; ++i)
    Console.Write("{0,3}", n[i]);
   Console.ReadKey(true);
  }
 }
}
Без дорогих сортировок и в одну строку:

a = (from x in a where x == 0 select x).Concat((from x in a where x != 0 select x)).ToArray();
int[] numbers = new int[] { 0,97, 45, 32, 65, 83, 23, 15,0 };
Array.Sort(numbers);
ОГ
Олег Ганжа
74 422
Олег Саяхов В данном случае sort невыгоден, так как нас не просят сортировать ВСЕ элементы.