2018-12-13作业

Console.Write("请选择运算: 1、加法 2、减法 3、乘法 、4、除法");
int num = Convert.ToInt32(Console .ReadLine());
Console.WriteLine("请输入第一个数:");
double a = Convert.ToDouble (Console .ReadLine());
Console.WriteLine("请输入第二个数");
double b = Convert.ToDouble(Console .ReadLine ());
double c = 0;
if (num == 1)
{
c = a + b;

        }
        if (num == 2)
        {
            if (a <= b)
            {
                c = b - a;
            }
             if (a>=b)
            {
                c = b - a;
            }
        }
        if (num == 3)
        {
            c = a * b;
        
        }
        if (num == 4)
        {
            c = a / b;
        }

            Console.WriteLine("****************运算结果是:{0}",c);
        Console.ReadKey();
2018-12-13作业_第1张图片
2))`MO4OE6$_T9G)HQ8F9IT.png

你可能感兴趣的:(2018-12-13作业)