import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
//Declare list of ArrayList
ArrayList<Integer> list = new ArrayList<Integer>();
//count is the number of repetitions
int count = 0;
count = scanner.nextInt();
//Store input value in list
for (int i = 0; i < count; i++) {
list.add(scanner.nextInt());
}
//Bubble sort of ArrayList
for (int i = 0; i < list.size() - 1; i++) {
for (int j = list.size() - 1; j > i; j--) {
if (array.get(j - 1) > list.get(j)) {
//Swap
int tmp = list.get(j - 1);
list.set(j -1, list.get(j));
list.set(j, tmp);
}
}
}
//Extended for statement
for(int a: list) {
System.out.println(a);
}
}
}
Recommended Posts