本文整理匯總了C#中System.Numerics.BigInteger.Min方法的典型用法代碼示例。如果您正苦於以下問題:C# BigInteger.Min方法的具體用法?C# BigInteger.Min怎麽用?C# BigInteger.Min使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Numerics.BigInteger
的用法示例。
在下文中一共展示了BigInteger.Min方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
//引入命名空間
using System;
using System.Numerics;
public class Example
{
public static void Main()
{
BigInteger[] numbers = { Int64.MaxValue * BigInteger.MinusOne,
BigInteger.MinusOne,
10359321239000,
BigInteger.Pow(103988, 2),
BigInteger.Multiply(Int32.MaxValue, Int16.MaxValue),
BigInteger.Add(BigInteger.Pow(Int64.MaxValue, 2),
BigInteger.Pow(Int32.MaxValue, 2)),
BigInteger.Zero };
if (numbers.Length < 2)
{
Console.WriteLine("Cannot determine which is the smaller of {0} numbers.",
numbers.Length);
return;
}
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("The values:");
foreach (BigInteger number in numbers)
Console.WriteLine("{0,55:N0}", number);
Console.WriteLine("\nThe smallest number of the series is:");
Console.WriteLine(" {0:N0}", smallest);
}
}
輸出:
The values: -9,223,372,036,854,775,807 -1 10,359,321,239,000 10,813,504,144 70,366,596,661,249 85,070,591,730,234,615,852,008,593,798,364,921,858 0 The smallest number of the series is: -9,223,372,036,854,775,807.