Сортиране на масив

mail@pastecode.io avatar
unknown
plain_text
a year ago
819 B
1
Indexable
Never
namespace Mehurche
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arrNum = new int[10];
            int temp = 0;

            for (int i = 0; i < arrNum.Length-1; i++)
            {
                arrNum[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 0; i < arrNum.Length - 1; i++)
                for (int j = 0; j < arrNum.Length - 1; j++)
                
                if (arrNum[j] > arrNum[j + 1])
                {
                    temp = arrNum[j];
                    arrNum[j] = arrNum[j + 1];
                    arrNum[j + 1] = temp;

                }
        for (int i = 0; i < arrNum.Length; i++)
            {
                Console.Write(arrNum[i] + ",");
            }
        }
    }
}