using System; using System.Collections.Generic; using System.Text; namespace BubbleSortTest { class BubbleSortTest { public static void Sort(int[] array) { int temp = 0; for (int i = 0; i < array.Length - 1; i++) { for (int j = 0; j < array.Length-1 - i; j++) { if (array[j] < array[j+1]) { temp = array[j]; array[j] = array[j + 1]; array[j + 1] = temp; } } } } } class Test { static void Main(string[] args) { int[] array ={ 6, 4, 7, 2,9, 1 }; BubbleSortTest.Sort(array); foreach(int index in array){ Console.Write(index+"\t"); } Console.Read(); } } }