int[] array = { 2, 4, 5, 9, 1, 3, 5, 6, 7 };
int temp = 0;
for (int i = 0; i < array.Length - 1; i++)
{
for (int j = i + 1; j < array.Length; j++)
{
if (array[j] < array[i])
{
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
for (int i = 0; i < array.Length; i ++ )
{
Console.WriteLine(array[i]);
}
int temp = 0;
for (int i = 0; i < array.Length - 1; i++)
{
for (int j = i + 1; j < array.Length; j++)
{
if (array[j] < array[i])
{
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
for (int i = 0; i < array.Length; i ++ )
{
Console.WriteLine(array[i]);
}