public class Demo {
public static void main(String[] args){
int a[] = new int[10];
int temp;
for(int i =0; i < 10; i++){
a[i] = (int)(Math.random()*100);
}
for(int i = 0; i < 10; 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] + " ");
}
}
}
本回答被提问者采纳