Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package HomeWork_Programming;
- import java.util.*;
- public class Task5 {
- public static void main(String[] args) {
- String str = "";
- Scanner scan = new Scanner(System.in);
- LinkedList ll = new LinkedList();
- int n;
- while (scan.hasNextInt()){ //Input only numbers. Quit with any letter
- n = scan.nextInt();
- ll.add(n); //Add to list
- }
- Collections.sort(ll); //sort the list
- for (int i = 0; i < ll.size(); i++) { //Output
- if (i == ll.size()-1)
- System.out.print(ll.get(i));
- else
- System.out.print(ll.get(i)+" <= ");
- }
- }//end of main
- }//end of class
Add Comment
Please, Sign In to add comment