有没有大神在,帮个忙
然后
输出(56,78,123,最大的数位123
)然后
输出(56,78,123,最大的数位123
)2016-08-05
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int N = 3, temp;
int[] arr = new int[N];
for (int i = 0; i < N; i++)
{
arr[i] = int.Parse(Console.ReadLine());
}
for (int i = 0; i < N - 1; i++)
{
for (int j = 0; j < N - i - 1; j++)
{
if (arr[j + 1] < arr[j])
{
temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
for (int i = 0; i < N; i++)
{
Console.Write(arr[i]);
}
Console.Write("最大的数为{0}", arr[N - 1]);
}
}
}
举报