用c#写一个控制台程序排列十个数的大小
来源:百度知道 编辑:UC知道 时间:2024/06/28 13:22:13
本人初学,知道的很少!
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int z = 0;
int[] number = new int[10];
for (int i = 0; i < number.Length; i++)
{
Console.WriteLine("请输入第" + (i + 1) + "个数;");
number[i] = Int32.Parse(Console.ReadLine());
}
for (int i = 0; i < number.Length; i++)
{
for (int y = 0; y < number.Length; y++)
{
if (number[i] < number[y])
{
z=number[i];
number[i] = number[y];
number[y] = z;
}
}
}<