Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.PrintStream;
- import java.util.Scanner;
- public class Main {
- public static Scanner in = new Scanner(System.in);
- public static PrintStream out = System.out;
- public static void main(String[] args) {
- int n = in.nextInt();
- int[] a = new int[n];
- for (int i = 0; i < n; i++) {
- a[i] = in.nextInt();
- }
- sort(a);
- }
- static void sort(int[] c) {
- int tmp;
- for (int i = 0; i < c.length; i++) {
- for (int j = c.length-2; j >= 0; j--) {
- if(c[j] > c[j+1]) {
- tmp = c[j];
- c[j] = c[j+1];
- c[j+1] = tmp;
- for (int C : c) {
- System.out.print(C + " ");
- }
- System.out.println();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement