21 January 2014

Find largest number in an integer array

using System;
using System.Linq;

namespace SamplePrograms
{
    class LargestSmallest
    {
        public static void Main()
        {
           
            int[] NumbersArray = { 100, 111, 501, 122, 10 };
            Array.Sort(NumbersArray);
            Console.WriteLine("Largest Number = {0}", NumbersArray[NumbersArray.Length - 1]);
        }
    }
}

No comments:

Post a Comment