Console.Write("The number of symbols is ");
char[] arr = new char[int.Parse(Console.ReadLine())];
Console.WriteLine("Enter the symbols:");
for(int i = 0; i < arr.Length; i++)
arr[i] = char.Parse(Console.ReadLine());
Console.Write("Enter the index: ");
int index = int.Parse(Console.ReadLine());
while(index < 0 || index >= arr.Length)
Console.Write("Enter valid index ");
index = int.Parse(Console.ReadLine());
arr = Sort<char>(arr, 0, index + 1);
arr = Sort<char>(arr, index + 1, arr.Length, false);
static T[] Sort<T>(T[] arr, int start, int end, bool isUp = true) where T:IComparable
for(int i = start + 1; i < end; i++)
for(j = i - 1; j >= start; j--)
if(arr[j].CompareTo(newValue) > 0 == isUp)
static void WriteTheArray(char[] arr)
Console.WriteLine("The symbols are: {0}.", String.Join(", ", arr));
public static void Main()