利用if else 求已发奖金总数

class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                double i,s,a,b,c,d,e,f;
             
                Console.Write("请输入当月利润:");
                i = Convert.ToDouble(Console.ReadLine());
                a = Convert.ToDouble(i * 0.1);
                b = Convert.ToDouble((i - 100000) * 0.075 + 10000);
                c = Convert.ToDouble((i - 200000) * 0.05 + 17500);
                d = Convert.ToDouble((i - 400000) * 0.03 + 27500);
                e = Convert.ToDouble((i - 600000) * 0.015 + 33500);
                f = Convert.ToDouble((i - 1000000) * 0.01 + 39500);
                if (i <= 100000)
                {
                    Console.WriteLine(a);
                }
                else if (i > 100000 && i <= 200000)
                {
                    Console.WriteLine(b);
                }
                else if (i > 200000 && i <= 400000)
                {
                    Console.WriteLine(c);
                }
                else if (i > 400000 && i <= 600000)
                {
                    Console.WriteLine(d);
                }
                else if (i > 600000 && i <= 1000000)
                {
                    Console.WriteLine(e);
                }
                else if (i > 1000000)
                {
                    Console.WriteLine(f);
                }
                else
                {
                    Console.WriteLine("请输入正确的金额");
                }
              
               
                Console.ReadLine();
            }
           
        }
    }
}

上一篇:容器的基本操作


下一篇:mongodb副本集加分片集群安全认证使用账号密码登录