Mega Code Archive

 
Categories / C# / Data Types
 

Returns the smaller of two BigInteger values

using System; using System.Numerics; public class Example {    public static void Main()    {       BigInteger[] numbers = { BigInteger.MinusOne, BigInteger.Pow(Int32.MaxValue, 2),BigInteger.Zero };       BigInteger smallest = numbers[numbers.GetLowerBound(0)];       for (int ctr = numbers.GetLowerBound(0) + 1; ctr <= numbers.GetUpperBound(0); ctr++)          smallest = BigInteger.Min(smallest, numbers[ctr]);       Console.WriteLine(smallest);    } }