• 输入三个数,从大到小排列


    //输入3个数,将这三个数从大到小排列打印出来;

                Console.Write("请输入第一个数字:");

                int a = int.Parse(Console.ReadLine());

                Console.Write("请输入第一个数字:");

                int b = int.Parse(Console.ReadLine());

                Console.Write("请输入第一个数字:");

                int c = int.Parse(Console.ReadLine());

                if(a>=b&&a>=c)

                {

                   if(b>=c)

                   {

                       Console.WriteLine(a);

                       Console.WriteLine(b);

                       Console.WriteLine(c);

                   }

                    else

                   {

                       Console.WriteLine(a);

                       Console.WriteLine(c);

                       Console.WriteLine(b);

                   }

                }

                if (b >= a && b>= c)

                {

                    if (a >= c)

                    {

                        Console.WriteLine(b);

                        Console.WriteLine(a);

                        Console.WriteLine(c);

                    }

                    else

                    {

                        Console.WriteLine(b);

                        Console.WriteLine(c);

                        Console.WriteLine(a);

                    }

                }

                if (c >= a && a >= b)

                {

                    if (a >= b)

                    {

                        Console.WriteLine(c);

                        Console.WriteLine(a);

                        Console.WriteLine(b);

                    }

                    else

                    {

                        Console.WriteLine(c);

                        Console.WriteLine(b);

                        Console.WriteLine(a);

                    }

                }

                Console.ReadLine();

  • 相关阅读:
    object c 基础语法
    Object-C 基础知识总结
    【POJ1475】Pushing Boxes-A*(或BFS?)
    【POJ1475】Pushing Boxes-A*(或BFS?)
    【POJ2286】The Rotation Game-迭代加深DFS+可行性剪枝
    【CodeVS1004】四子连棋-迭代加深搜索入门
    【CodeVS1004】四子连棋-迭代加深搜索入门
    【Poj2449】Remmarguts' Date-k短路(A*解法)
    【Poj2449】Remmarguts' Date-k短路(A*解法)
    【HDU4090】Gem and Prince-DFS+可行性剪枝
  • 原文地址:https://www.cnblogs.com/fengsantianya/p/5456551.html
Copyright © 2020-2023  润新知