C# BigInteger Divide

Description

BigInteger Divide Divides one BigInteger value by another and returns the result.

Syntax

BigInteger.Divide has the following syntax.


public static BigInteger Divide(
  BigInteger dividend,
  BigInteger divisor
)

Parameters

BigInteger.Divide has the following parameters.

  • dividend - The value to be divided.
  • divisor - The value to divide by.

Returns

BigInteger.Divide method returns The quotient of the division.

Example


using System;/*from www. j av  a  2 s. c o  m*/
using System.Numerics;

public class Example
{
   public static void Main()
   {
      BigInteger divisor = BigInteger.Pow(Int64.MaxValue, 2);

      BigInteger[] dividends = {BigInteger.One, 
                                 BigInteger.Multiply(Int32.MaxValue, Int64.MaxValue),
                                 divisor + BigInteger.One };

      foreach (BigInteger dividend in dividends)
      {
         Console.WriteLine(BigInteger.Divide(dividend, divisor));
      }            
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex