using System;
public class Program {
//Bubble sort function
private static float[] BubbleSort(float[] Array){
bool Sorted = false;
while (!Sorted){
Sorted = true;
for (int i = 0; i < Array.Length-1; i++)
{
if (Array[i] > Array[i+1]){
//swap Array[i] and Array[i+1]
Sorted = false;
float Temp = Array[i+1];
Array[i+1] = Array[i];
Array[i] = Temp;
}
}
}
return Array;
}
public static void Main() {
float[] UnSortedList = {1,56,3,6,7,543,542,1,555,4,1091};
float[] SortedList = BubbleSort(UnSortedList);
//prints the Sorted array
for (int i = 0; i < SortedList.Length; i++)
{
Console.Write(SortedList[i] + " ");
}
Console.ReadKey();
}
}