Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Bubble Sort
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { Console.Write("Enter number of elements: "); int n = int.Parse(Console.ReadLine()); int[] num = new int[n]; for(int i = 0; i<num.Length;i++) { Console.Write("Enter elements: "); num[i] = int.Parse(Console.ReadLine()); } int temp = 0; for (int x = 0; x < num.Length; x++) { for (int sort = 0; sort < num.Length ; sort++) { if (num[sort] > num[sort + 1]) { temp = num[sort + 1]; num[sort + 1] = num[sort]; num[sort] = temp; } } } foreach(int r in num) { Console.WriteLine(num); } } } }
run
|
edit
|
history
|
help
0
borrar_xml_tags_vacios
TuplaDivWriteHexa
Static Class
DB Search
SAF Mid Terms
asdxcscd
Display the pattern like diamond by using c# for loop
Repeated char
First Class
ReplaceNotExpectedCharacters