using System;
public class Program
{
static void shakersort(int[] a, int n)
int k = n, R = n - 1;
int L = 1, j = 0, rab = 0;
do
for (j = R; j >= L; j--)
if (a[j - 1] > a[j])
rab = a[j];
a[j] = a[j - 1];
a[j - 1] = rab;
k = j;
}
L = k + 1;
for (j = L; j <= R; j++)
R = k - 1;
while (L <= R);
public static void Main()
int[] a = {4, 2, 6, 5, 1, 3};
int n = 6;
shakersort(a, n);
for (int i = 0; i < n; i++)
Console.WriteLine(a[i]);