By The simple loop of an array you can also do sorting.
check the below working code
class Program
{
enum array : int
{
size = 5,
size_1 = 2,
}
static void Main(string[] args)
{
int x;
int[] a_1 = new int[(int)array.size];
Console.WriteLine("\n\t\tThis is a program for All Basic Array Uses.");
for (x = 0; x < (int)array.size; x++)
{
Console.WriteLine("\nEnter Value In Array [{0}] Index.", x + 1);
a_1[x] = Convert.ToInt32(Console.ReadLine());
}
sort(a_1);
Console.ReadLine();
}
static void sort(int[] a_1)
{
int x, temp = 0;
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("\n\t\tAfter Sorting Of Array.");
Console.ResetColor();
for (x = 0; x < (int)array.size; x++)
{
for (int y = 0; y < (int)array.size; y++)
{
if (a_1[x] < a_1[y])
{
temp = a_1[x];
a_1[x] = a_1[y];
a_1[y] = temp;
}
}
}
for (x = 0; x < (int)array.size; x++)
{
Console.WriteLine(a_1[x]);
}
}
}