问答详情
源自:3-8 编程练习

简化一下代码

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            double money = 60000.00;//存款金额
            if(money>=100000)
            Console.WriteLine("送一台微波炉");
            else if(money>=50000)
            Console.WriteLine("送一套茶具");
            else if(money>=10000)
            Console.WriteLine("送一袋大米");
            else
            Console.WriteLine("没有礼品");
        }
    }
}


提问者:lucasj 2024-06-11 16:00

个回答

  • weixin_慕粉2246583
    2024-06-21 18:03:51

    namespace Test
    {
        class Program
        {
            static void Main(string[] args)
            {

                double money = 60000.00;//存款金额

                string x="";

                if(money>=100000)
                x="送一台微波炉";
                else if(money>=50000)
                x="送一套茶具";
                else if(money>=10000)
                x="送一袋大米";
                else

                x="没有礼品";


               Console.WriteLine(x); 

            }
        }
    }