标签:
package excel; import java.util.Scanner; public class doExcel { public static void main(String args[]){ Scanner input=new Scanner(System.in); int n; System.out.print("input n:"); n=input.nextInt(); int num[]=new int[n]; for(int i=0;i<n;i++){ num[i]=input.nextInt(); } for(int i=0;i<n-1;i++){ for(int j=0;j<n-1-i;j++){ if(num[j]>num[j+1]){ int c=0; c=num[j+1]; num[j+1]=num[j]; num[j]=c; } } } for(int i=0;i<n;i++){ System.out.print(num[i]+" "); } } }
标签:
原文地址:http://www.cnblogs.com/wpzy2311/p/5021507.html