Max


私信TA

用户名:1710958430

访问量:2304

签 名:

bug多如牛毛!

等  级
排  名 1925
经  验 2458
参赛次数 2
文章发表 6
年  龄 23
在职情况 在职
学  校 保定职业技术学院
专  业

  自我简介:

解题思路:

注意事项:

参考代码:

import java.util.Scanner;
public class Main {
   public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       int n[]={4,85,3,234,45,345,345,122,30,12};
       int temp=0;
       for (int i=0;i<n.length-1;i++){
           int index=i;//比较初值
           for (int j=i+1;j<n.length;j++){
               if(n[j]<n[index]){
                   index=j;
               }
           }
           if (index!=i){
               temp     = n[i];
               n[i]     = n[index];
               n[index] = temp;
           }
       }
       for (int k=0;k<n.length;k++){
           System.out.print(n[k]+" ");
       }


   }

}

 

0.0分

1 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区