using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CH02
{
class Program
{
static void Main(string[] args)
{
int a = 0;
int[] num = new int[] { 19, 1, 38, 49, 85, 16, 867, 282 };
for (int i = 0; i < num.Length - 1; i++)
{
for (int j = 0; j < num.Length - 1 - i; j++)
{
if (num[j] > num[j + 1]) //降序改为“<”
{
a = num[j];
num[j] = num[j + 1];
num[j + 1] = a;
}
}
}
Console.WriteLine("从小到大排序:");
foreach (int number in num)
{
Console.Write(number + " ");
}
Console.ReadKey();
}
}
}