您的位置:首页 > 编程语言 > C#

用C#求A+B A,B在同一行输入,之间用空格隔开

2017-01-22 14:13 399 查看
2个整数A B,中间用空格分割。(0 <= A, B <= 10^9)
输出A + B的计算结果。
-------------------------------------------------------------------------
using System;
using System.IO;
using System.Numerics;
public class Sum
{
    public static void Main()
    {
        StreamReader sr = new StreamReader(Console.OpenStandardInput());
        StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
        string[] s = sr.ReadLine().Split(' ');
        sw.WriteLine(BigInteger.Parse(s[0]) + BigInteger.Parse(s[1]));
        sr.Close();
        sw.Close();
    }
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐