Sorting the Number using Range.

How to Sort the number using Range.

using System;

namespace Test_Application
{
     public class Program
    {
        static void Main(string[] args)
        {
            int j;
            int[] a = { 3, 8, 5, 9, 2, 0, 1 };
             Array.Sort(a,0,5); // here 0 to 5  means sort between to numbers
            foreach (int i in a)
            {
                 j = i;
                Console.WriteLine(j);
            }
         
        Console.ReadLine();

        }
    }
}

Output:-  2, 3, 5 ,8, 9, 0, 1

Share this

Previous
Next Post »