Handling "Big" Integers in C#
- by priyanka.sarkar
How do I handle big integers in C#?
I have a function that will give me the product of divisors:
private static int GetDivisorProduct(int N, int product)
{
for (int i = 1; i < N; i++)
{
if (N % i == 0)
{
Console.WriteLine(i.ToString());
product *= i;
}
}
return product;
}
The calling function is GetDivisorProduct(N, 1)
If the result is bigger than 4 digits , I should obtain only the last 4 digits. ( E.g. If I give an input of 957, the output is 7493 after trimming out only the last four values.
The actual result is 876467493.).
Other sample inputs: If I give 10000, the output is 0.
The BigInteger class has been removed from the C# library!
How can I get the last four digits?