C#利用三目运算符判断大小


            Console.WriteLine("请输入第一个数");
            int a = int.Parse(Console.ReadLine());
            Console.WriteLine("请输入第二个数");
            int b = int.Parse(Console.ReadLine());
            Console.WriteLine("请输入第三个数");
            int c = int.Parse(Console.ReadLine());
            int d = a > b ? a : b;
            d = c > d ? c : d;
            Console.WriteLine(d);

猜你喜欢

转载自blog.csdn.net/qq_28058231/article/details/108879158