BubbleSort
1 class Program 2 { 3 static void Main(string[] args) 4 { 5 int[] arr = { 0,2,7,8,6,9,5,3,1,4}; 6 for (int i = 0; i < arr.Length; i++) 7 { 8 for (int j = 0; j < arr.Length - 1 - i; j++) 9 { 10 int temp; 11 if (arr[j] > arr[j + 1]) 12 { 13 temp = arr[j]; 14 arr[j] = arr[j + 1]; 15 arr[j + 1] = temp; 16 } 17 } 18 } 19 for (int i = 0; i < arr.Length; i++) 20 { 21 Console.WriteLine(arr[i]); 22 } 23 Console.ReadKey(); 24 } 25 }