package com.hanqi; import java.util.Scanner; public class zuoyemaopaopaixv { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("请输入要排序的个数:"); Scanner v = new Scanner(System.in); int geshu = v.nextInt(); int arr[]=new int[geshu]; for(int a = 0 ; a < geshu ; a++) { System.out.println("请输入第" + (a+1) + "个数:"); arr[a]=v.nextInt(); } for(int d=1 ; d<=arr.length-1 ; d++) { for(int b = 1 ; b<=arr.length-d ; b++) { if(arr[b-1]<arr[b]) { int c=arr[b]; arr[b]=arr[b-1]; arr[b-1]=c; } } } for(int i=0;i<arr.length;i++) { System.out.println(arr[i]); } } }