Sort the number using Array in C#

How to sort the number using Array.

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);
            foreach (int i in a)
            {
                 j = i;
                Console.WriteLine(j);
            }
           
        Console.ReadLine();

        }
    }
}

Output is  0 12 3 5 8 9

Share this

Previous
Next Post »