Skip to main content

Sorting array in c sharp # with use of functions

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace My
{

    class MyClass
    {
        MyClass(int y)
        {

        }
        static void Main(string[] args)
        {
            int[] arr = { 1, 9, 8, 7, 5, 6, 8, 1, 2, };
            foreach (int n in arr)
            {
                Console.Write(n+" ");

            }
            Array.Sort(arr);
            Console.WriteLine();
            foreach (int n in arr)
            {
                Console.Write(n + " ");

            }
           
            Array.Reverse(arr);
            Console.WriteLine();
            foreach (int n in arr)
            {
                Console.Write(n + " ");

            }
           
            Console.Read();


           

        }


    }
}

Comments

Popular posts from this blog

unix commands