标签:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
int[] array = new int[5]{2,1,3,4,5};
for (int i = 0; i < array.Length; i++)
{
for (int j = i + 1; j < array.Length; j++)
{
if (array[j] < array[i])
{
int temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
foreach (int n in array)
Console.WriteLine(n);
Console.ReadLine();
}
}
}

标签:
原文地址:http://www.cnblogs.com/zhuxu/p/5199822.html