第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

有沒有大神在,幫個忙

有木有哪位大神可以幫我寫個程序,即使隨意輸入一個數(shù)組,然后把每個數(shù)組中的數(shù)字的各個位數(shù)按照升序排列,再把這個數(shù)組排序后輸出最大的數(shù),比如輸入(312,56,87),

然后

輸出(56,78,123,最大的

數(shù)位123

正在回答

1 回答

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("最大的數(shù)為{0}", arr[N - 1]);

? ? ? ? }

? ? }

}


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

有沒有大神在,幫個忙

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號