Как переделать данный код под работу с большими числами? - C#
Формулировка задачи:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;
using System.Numerics;
namespace ConsoleApplication2
{
internal class Program
{
private static void Main(string[] args)
{
int e = 37;
int n = 2240;
int d = Foo(e, n);
Console.WriteLine(d);
Console.ReadKey();
}
private static int Foo(int a, int m)
{
int x, y;
int g = GCD(a, m, out x, out y);
if (g != 1)
throw new ArgumentException();
return (x % m + m) % m;
}
private static int GCD(int a, int b, out int x, out int y)
{
if (a == 0)
{
x = 0;
y = 1;
return b;
}
int x1, y1;
int d = GCD(b % a, a, out x1, out y1);
x = y1 - (b / a) * x1;
y = x1;
return d;
}
}
}Решение задачи: «Как переделать данный код под работу с большими числами?»
textual
Листинг программы
BigInteger bi=new BigInteger();