C#加减乘除

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

namespace Ch03Ex02
{
    class Program
    {
        static void Main(string[] args)
        {
            double firstNumber, secondNumber;
            string userName;

            Console.WriteLine("请输入姓名:");
            userName = Console.ReadLine();
            Console.WriteLine("请输入第一个数字:");
            firstNumber = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("请输入第二个数字:");
            secondNumber = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("数字{0}加{1}结果是:{2}",firstNumber,secondNumber,firstNumber+secondNumber);
            Console.WriteLine("数字{0}减{1}结果是:{2}", firstNumber, secondNumber, firstNumber - secondNumber);
            Console.WriteLine("数字{0}乘{1}结果是:{2}", firstNumber, secondNumber, firstNumber * secondNumber);
            Console.WriteLine("数字{0}除{1}结果是:{2}", firstNumber, secondNumber, firstNumber / secondNumber);
            Console.WriteLine("数字{0}余{1}结果是:{2}", firstNumber, secondNumber, firstNumber % secondNumber);

            Console.ReadKey();
        }
    }
}


posted @ 2017-04-13 18:43  TBHacker  阅读(1624)  评论(0编辑  收藏  举报