-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPractice28.java
More file actions
36 lines (32 loc) · 846 Bytes
/
Copy pathPractice28.java
File metadata and controls
36 lines (32 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package fiftypratice;
import java.util.Arrays;
import java.util.Scanner;
/**
* ÌâÄ¿£º¶Ô10¸öÊý½øÐÐÅÅÐò
*
* */
public class Practice28 {
public static void main(String[] args) {
int arr[]=new int[10];
System.out.println("Please input ten number:");
Scanner s=new Scanner(System.in);
for(int i=0;i<arr.length;i++){
arr[i]=s.nextInt();
}
if(s!=null){
s.close();
}
for(int j=0;j<arr.length-1;j++){
for(int i=j+1;i<arr.length;i++){
//int max=arr[i];
if(arr[i]>arr[j]){
int temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
String info=Arrays.toString(arr);
System.out.println("The result of selecting sort:"+info);
}
}