Do modulus division on a BigInteger raised to the power of another number in CSharp

Description

The following code shows how to do modulus division on a BigInteger raised to the power of another number.

Example


  /*  w  w  w .  j a  v a 2 s.  co  m*/
  
  
  

using System;
using System.Numerics;

public class Class1
{
   public static void Main()
   {
      BigInteger number = 10;
      int exponent = 3;
      BigInteger modulus = 30;
      Console.WriteLine("({0}^{1}) Mod {2} = {3}", 
                        number, exponent, modulus, 
                        BigInteger.ModPow(number, exponent, modulus));    
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var