C# BigInteger Remainder
Description
BigInteger Remainder
Performs integer division on two
BigInteger values and returns the remainder.
Syntax
BigInteger.Remainder
has the following syntax.
public static BigInteger Remainder(
BigInteger dividend,
BigInteger divisor
)
Parameters
BigInteger.Remainder
has the following parameters.
dividend
- The value to be divided.divisor
- The value to divide by.
Returns
BigInteger.Remainder
method returns The remainder after dividing dividend by divisor.
Example
using System;/*from w ww. j av a 2 s . c om*/
using System.Numerics;
public class Example
{
public static void Main()
{
BigInteger dividend1 = BigInteger.Pow(Int64.MaxValue, 3);
BigInteger dividend2 = dividend1 * BigInteger.MinusOne;
BigInteger divisor1 = Int32.MaxValue;
BigInteger divisor2 = divisor1 * BigInteger.MinusOne;
BigInteger remainder1, remainder2;
remainder1 = BigInteger.Remainder(dividend1, divisor1);
remainder2 = BigInteger.Remainder(dividend2, divisor1);
Console.WriteLine(remainder1);
}
}
The code above generates the following result.