using System;
namespace learn
{
class Learn
{
static void Main()
{
int a = 5;
int b = 3;
int c = 6;
int d = 4;
int e = 1;
int v;
for (int f = 0;f<100 ;f++)
{
Console.WriteLine("{0}{1}{2}{3}{4}",a, b, c, d, e);
Console.ReadKey();
if (b < a)
{
v = b;
b = a;
a = v;
}
if (c < b)
{
v = c;
c = b;
b = v;
}
if (d < c)
{
v = d;
d = c;
c = v;
}
if (e < d)
{
v = e;
e = d;
d = v;
}
}
}
}
}
首先创建五个数
进行一个循环
每两个数进行一次判断
如果是大于,则置换两个数