Пример #1
0
 static void Main(string[] args)
 {
     BigInteger a = new BigInteger(Console.ReadLine());
     BigInteger b = new BigInteger(Console.ReadLine());
     BigInteger c = a + b;
     Console.WriteLine(c);
     Console.ReadKey();
 }
Пример #2
0
 public static BigInteger operator + (BigInteger x, BigInteger y)
 {
     BigInteger c = new BigInteger();
     c.n = Math.Max(x.n, y.n);
     int add = 0;
     for(int i = 0; i < c.n; ++i)
     {
         c.a[i] = x.a[i] + y.a[i] + add;
         add = c.a[i] / 10;
         c.a[i] %= 10;
     }
     if (add > 0) c.a[c.n++] = add;
     return c;
 }