namespace maopao
{
class Program
{
static void Main(string[] args)
{
int[] a = { 8, 2, 3, 7, 5 };
int i, j;
int temp = 0;
//注意下面这条语句
for (i = 0; i < a.Length-4; i++)
{
for (j = 0; j < a.Length-1-i; j++)
if (a[j] > a[j+1])
{
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
}
for ( i = 0; i < a.Length;i++)
{
Console.WriteLine("{0}",a[i]);
}
Console.ReadKey();
}