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) { int[] a = { 3, 2, 5, 4, 1 }; int t; Console.WriteLine("The Array is : "); for (int i = 0; i < a.Length; i++) { Console.WriteLine(a[i]); } for (int j = 0; j <= a.Length - 2; j++) { for (int i = 0; i <= a.Length - 2; i++) { if (a[i] > a[i + 1]) { t = a[i + 1]; a[i + 1] = a[i]; a[i] = t; } } } Console.WriteLine("The Sorted Array :"); foreach (int aray in a) Console.Write(aray + " "); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
2.1.1 Basic types: Lists and Linq - caveat
bc160400236
Secure random string
c# problem
A
sample
LCM Q 3
Plt-D v.0.9.6 (Speed Vector)
Abstract Example
KeyValue pair C#
stackse - search stackoverflow differently
Please log in to post a comment.