【C#】Calculate A + B.

益承颜
2023-12-01
namespace CalculateAB
{
    #region using directive

    using System;

    #endregion

    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.In.ReadLine();
            while (input != null)
            {
                var param = input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if ((param != null) && (param.Length == 2))
                {
                    Int32 a = -1, b = -1;
                    if ((Int32.TryParse(param[0], out a) == true) && (Int32.TryParse(param[1], out b) == true))
                    {
                        Console.WriteLine(a + b);
                    }
                }
                input = Console.In.ReadLine();
            }
        }
    }
}

 

 类似资料: