给出两个整数a和b,请计算他们的和a + b,比如输入1和2,计算出结果为3。


/*
    给出两个整数a和b,请计算他们的和a + b,比如输入1和2,计算出结果为3。
    输入示例:
    1 2
    3 4
    5 6
    7 8
    输出示例:
    3
    7
    11
    15
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace taotao
{
    class Class1
    {
        static void Main(string[] args)
        {
            string temp = Console.ReadLine();

            List ilist = new List();

            while (temp != null)
            {
                string[] lala = temp.Split(' ');

                int a = Int32.Parse(lala[0]);
                int b = Int32.Parse(lala[1]);
                ilist.Add(a + b);
                temp = Console.ReadLine();
            }

            foreach (var item in ilist)
            {
                Console.WriteLine(item);
            }
            // Console.ReadKey();
        }
    }
}




你可能感兴趣的:(c#,面试)