C#練習- 輸入n個數(數字之間空格隔開),找出其中最小的數,將它與最前面的數交換後輸出這些數

思路:用一個min變量存儲數組第一個值,for循環依次和所有元素比較,記錄最小值下標,最後一步進行最小值和數組第一個值交換 string str = Console.ReadLine(); string[] arr = str.Split(' '); int[] arrNum = new int[arr.Length]; for (int i = 0
相關文章
相關標籤/搜索