Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
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
Please
log in
to post a comment.
Rextester
octalofint
Get Distinct value using Group By , Having , Count in DataTable C#
C Triangle
List Compare and print - Except
tst
Weird behaiour of conditional operator
ö1
xml into dictionary
practice program
stackse - search stackoverflow differently
Please log in to post a comment.