int[] b = { 3, 2, 5, 4, 1 };
int c;
for (int p = 0; p <= b.Length - 2; p++)
{
for (int i = 0; i <= b.Length - 2; i++)
{
if (b[i] > b[i + 1])
{
c = b[i + 1];
b[i + 1] = b[i];
b[i] = c;
}
}
}
foreach (int aa in b)
Console.Write(aa + " ");
Console.ReadLine();
VulpesPosted Sep 13, 2014, 3:38 PM
Muhammad AdeelPosted Sep 14, 2014, 1:15 PM
VulpesPosted Sep 14, 2014, 9:58 AM
Notice that I added a Console.WriteLine so that each set of numbers would appear on a new line.
Muhammad AdeelPosted Sep 14, 2014, 9:25 AM
Muhammad AdeelPosted Sep 14, 2014, 9:25 AM