using System;

namespace _2023._06._13
{
    class Program
    {
        static void cseresrendezes()
        {
            int[] t = {22, -5, 4, 33, 9, -3, 7, 15, 0, 20};
            int n = t.Length;
            
            for (int i = 0; i < n; i++)
            {
                System.Console.WriteLine(t[i]);
            }
            System.Console.WriteLine();

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    if (t[i] > t[j])
                    {
                        int swap = t[j];
                        t[j] = t[i];
                        t[i] = swap;
                    }
                }
            }

            for (int i = 0; i < n; i++)
            {
                System.Console.WriteLine(t[i]);
            }
            System.Console.WriteLine();
        }

        static void buborek()
        {
            int[] t = {5, 14, 9, -3, 7, 0, -11, 12};
            int n = t.Length;

            for (int i = 0; i < n; i++)
            {
                System.Console.WriteLine(t[i]);
            }
            System.Console.WriteLine();
            
            for (int i = n - 1; i > 0; i++)
            {
                for (int j = 1; j < i; j++)
                {
                    if (t[j] > t[j + 1])
                    {
                        int tmp = t[j + 1];
                        t[j + 1] = t[j];
                        t[j] = tmp;
                    }
                }
            }

            for (int i = 0; i < n; i++)
            {
                System.Console.WriteLine(t[i]);
            }
            System.Console.WriteLine();
        }

        static void Main(string[] args)
        {
            buborek();
        }
    }
}