using System;
public class test
{
static string Add(string x, string y)
{
string s3 = "";
int l1 = x.Length;
int l2 = y.Length;
Console.WriteLine("s1.length : {0} s2.length : {1} ", l1, l2);
while (l1 > 0 || l2 > 0)
{
l1--;
l2--;
if (l1 >= 0 && l2 >= 0)
{
s3 = (int.Parse(x.Substring(l1, 1)) + int.Parse(y.Substring(l2, 1))).ToString() + s3;
}
else if (l2 >= 0)
{
s3 = (int.Parse(y.Substring(l2, 1))).ToString() + s3;
}
else
{
s3 = (int.Parse(x.Substring(l1, 1))).ToString() + s3;
}
}
return s3;
}
public static void Main()
{
//只考虑二个正整数相加
Console.WriteLine("***** Big number Add Big number ****");
Console.WriteLine("Enter the number1");
string s1 = Console.ReadLine();
Console.WriteLine("Enter the number2");
string s2 = Console.ReadLine();
Console.WriteLine("Before Add :/n number1: {0}/n number2: {1}", s1, s2);
Console.WriteLine("Answer is : {0}", Add(s1,s2));
}
}