1412C#BubbleSort 

Run Settings
LanguageC#
Language Version
Run Command
using System; namespace Mhcrnl { class MainClass { static void swapp(ref int a, ref int b){ int temp=a; a=b; b=temp; } static void bubbleSort(int[] arr){ bool swapped; for (int i=0; i<arr.Length-1; i++){ swapped = false ; for(int j=0; j<arr.Length-i-1; j++){ if (arr [j]>arr[j+1]){ swapp(ref arr[j], ref arr[j+1]); swapped = true; } } if (swapped == false) break; } } static void printArray(int[] arr){ for(int i=0; i<arr.Length; i++){ Console.Write(arr[i]+" "); } } static void Main() { Console.WriteLine("Hello World!"); int a=3,b=4; Console.WriteLine(a+" "+b); swapp(ref a,ref b ); Console.WriteLine (a+" "+b); int[] arr ={ 78,89,2,5,3,23,45}; bubbleSort (arr ); printArray(arr); } } }
Editor Settings
Theme
Key bindings
Full width
Lines