update
This commit is contained in:
20
DEV.2.1/TP/TP1-introduction/Tri.java
Normal file
20
DEV.2.1/TP/TP1-introduction/Tri.java
Normal file
@@ -0,0 +1,20 @@
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Tri {
|
||||
public static void main(String[] args) {
|
||||
if (args.length == 0) {
|
||||
System.out.println("Veuillez fournir des nombres en arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
int[] nombres = new int[args.length];
|
||||
|
||||
for(int i = 0; i<args.length; i++) {
|
||||
nombres[i] = Integer.parseInt(args[i]);
|
||||
}
|
||||
|
||||
Arrays.sort(nombres);
|
||||
System.out.println("Voici votre liste de nombre trié : "+Arrays.toString(nombres));
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user