import java.util.Scanner;
public class NumsSort {
public static void main(String arg[]) {
Scanner nums=new Scanner(System.in);
int a[]=new int[10];
for (int i = 0; i < 10; i++) {
a[i] = nums.nextInt();
}
int temp;
for (int i=0; i<9; i++) {
for (int j=i+1; j<10; j++) {
if (a[i] > a[j]) {
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
for (int i=0; i<10; i++) {
System.out.print(a[i] + " ");
}
}
}
Java编程题:从键盘键入10个数从小到大排序
最新推荐文章于 2024-10-19 10:15:00 发布